Skip to content

Commit aedb5c4

Browse files
jankeromnesroboquat
authored andcommitted
[installer][server] Clarify 'inactivityPeriodForRepos' by renaming it to '...InDays'
1 parent 9e4c0f9 commit aedb5c4

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

components/server/ee/src/prebuilds/prebuild-manager.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,18 @@ export class PrebuildManager {
406406

407407
private async shouldSkipInactiveRepository(ctx: TraceContext, cloneURL: string): Promise<boolean> {
408408
const span = TraceContext.startSpan("shouldSkipInactiveRepository", ctx);
409-
const { inactivityPeriodForRepos } = this.config;
410-
if (!inactivityPeriodForRepos) {
411-
// skipping is disabled if `inactivityPeriodForRepos` is not set
409+
const { inactivityPeriodForReposInDays } = this.config;
410+
if (!inactivityPeriodForReposInDays) {
411+
// skipping is disabled if `inactivityPeriodForReposInDays` is not set
412412
span.finish();
413413
return false;
414414
}
415415
try {
416416
return (
417417
(await this.workspaceDB
418418
.trace({ span })
419-
.getWorkspaceCountByCloneURL(cloneURL, inactivityPeriodForRepos /* in days */, "regular")) === 0
419+
.getWorkspaceCountByCloneURL(cloneURL, inactivityPeriodForReposInDays /* in days */, "regular")) ===
420+
0
420421
);
421422
} catch (error) {
422423
log.error("cannot compute activity for repository", { cloneURL }, error);

components/server/src/config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type Config = Omit<
2929
stripeSecrets?: { publishableKey: string; secretKey: string };
3030
stripeConfig?: StripeConfig;
3131
builtinAuthProvidersConfigured: boolean;
32-
inactivityPeriodForRepos?: number;
32+
inactivityPeriodForReposInDays?: number;
3333
};
3434

3535
export interface WorkspaceDefaults {
@@ -203,7 +203,7 @@ export interface ConfigSerialized {
203203
* If a numeric value interpreted as days is set, repositories not beeing opened with Gitpod are
204204
* considered inactive.
205205
*/
206-
inactivityPeriodForRepos?: number;
206+
inactivityPeriodForReposInDays?: number;
207207

208208
/**
209209
* Supported workspace classes
@@ -285,10 +285,10 @@ export namespace ConfigFile {
285285
if (licenseFile) {
286286
license = fs.readFileSync(filePathTelepresenceAware(licenseFile), "utf-8");
287287
}
288-
let inactivityPeriodForRepos: number | undefined;
289-
if (typeof config.inactivityPeriodForRepos === "number") {
290-
if (config.inactivityPeriodForRepos >= 1) {
291-
inactivityPeriodForRepos = config.inactivityPeriodForRepos;
288+
let inactivityPeriodForReposInDays: number | undefined;
289+
if (typeof config.inactivityPeriodForReposInDays === "number") {
290+
if (config.inactivityPeriodForReposInDays >= 1) {
291+
inactivityPeriodForReposInDays = config.inactivityPeriodForReposInDays;
292292
}
293293
}
294294

@@ -320,7 +320,7 @@ export namespace ConfigFile {
320320
? new Date(config.workspaceGarbageCollection.startDate).getTime()
321321
: Date.now(),
322322
},
323-
inactivityPeriodForRepos,
323+
inactivityPeriodForReposInDays,
324324
};
325325
}
326326
}

install/installer/pkg/components/server/configmap.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
176176
return nil
177177
})
178178

179-
inactivityPeriodForRepos := 0
179+
inactivityPeriodForReposInDays := 0
180180
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
181-
if cfg.WebApp != nil && cfg.WebApp.Server != nil && cfg.WebApp.Server.InactivityPeriodForRepos != nil {
182-
inactivityPeriodForRepos = *cfg.WebApp.Server.InactivityPeriodForRepos
181+
if cfg.WebApp != nil && cfg.WebApp.Server != nil && cfg.WebApp.Server.InactivityPeriodForReposInDays != nil {
182+
inactivityPeriodForReposInDays = *cfg.WebApp.Server.InactivityPeriodForReposInDays
183183
}
184184
return nil
185185
})
@@ -271,8 +271,8 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
271271
// default limit for all cloneURLs
272272
"*": 50,
273273
},
274-
WorkspaceClasses: workspaceClasses,
275-
InactivityPeriodForRepos: inactivityPeriodForRepos,
274+
WorkspaceClasses: workspaceClasses,
275+
InactivityPeriodForReposInDays: inactivityPeriodForReposInDays,
276276
}
277277

278278
fc, err := common.ToJSONString(scfg)

install/installer/pkg/components/server/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ type ConfigSerialized struct {
5252
CodeSync CodeSync `json:"codeSync"`
5353
// PrebuildLimiter defines the number of prebuilds allowed for each cloneURL in a given 1 minute interval
5454
// Key of "*" defines the default limit, unless there exists a cloneURL in the map which overrides it.
55-
PrebuildLimiter map[string]int `json:"prebuildLimiter"`
56-
WorkspaceClasses []WorkspaceClass `json:"workspaceClasses"`
57-
InactivityPeriodForRepos int `json:"inactivityPeriodForRepos"`
55+
PrebuildLimiter map[string]int `json:"prebuildLimiter"`
56+
WorkspaceClasses []WorkspaceClass `json:"workspaceClasses"`
57+
InactivityPeriodForReposInDays int `json:"inactivityPeriodForReposInDays"`
5858
}
5959
type CodeSyncResources struct {
6060
RevLimit int32 `json:"revLimit"`

install/installer/pkg/config/v1/experimental/experimental.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ type ServerConfig struct {
232232
EnableLocalApp *bool `json:"enableLocalApp"`
233233
RunDbDeleter *bool `json:"runDbDeleter"`
234234
DisableWorkspaceGarbageCollection bool `json:"disableWorkspaceGarbageCollection"`
235-
InactivityPeriodForRepos *int `json:"inactivityPeriodForRepos"`
235+
InactivityPeriodForReposInDays *int `json:"inactivityPeriodForReposInDays"`
236236

237237
// @deprecated use containerRegistry.privateBaseImageAllowList instead
238238
DefaultBaseImageRegistryWhiteList []string `json:"defaultBaseImageRegistryWhitelist"`

0 commit comments

Comments
 (0)