Skip to content

Commit

Permalink
revert some helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
dvallin committed Jun 25, 2019
1 parent 8a6a1f1 commit 6152cd3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
8 changes: 0 additions & 8 deletions src/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 89,21 @@ export class Application {
}

initArtifacts(artifactRepoFromConfig(config))
console.log('intialized artifacts')
initViews(config)
console.log('intialized views')
initEvents([SlackEventRepository.fromConfig(config.slack)])
console.log('intialized events')
initCluster(KubernetesClusterRepository.fromConfig(config.kube, config.namespaces))
console.log('intialized cluster')
initImages(DockerImageRepository.fromConfig(config.docker))
console.log('intialized images')

const jobs = JobsRepositoryImpl.fromConfig(config.pipelines, this.crons)
initJobs(jobs)
console.log('intialized jobs')

if (process.env.LAYER === Layers.Server) {
const gitRepo = gitRepoFromConfig(config)
console.log('intialized git')
if (gitRepo !== undefined) {
await this.checkForConfigChange(gitRepo)
this.crons.register('config-reload', config.git!.cron, () => this.checkForConfigChange(gitRepo))
}
this.crons.startAllCrons()
console.log('intialized crons')
}
}
}
12 changes: 1 addition & 11 deletions src/crons/CronRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 10,7 @@ export class CronRegistry {
private readonly io: IO = new IO()

public register(name: string, cronTab: string, promiseProvider: () => Promise<void>, start: boolean = false) {
console.log('register ', name, start)
const cron = new CronJob(
cronTab,
() => {
console.log('execute ', name, start)
this.executeTask(name, promiseProvider)
},
() => {},
start,
'UTC'
)
const cron = new CronJob(cronTab, () => this.executeTask(name, promiseProvider), () => {}, start, 'UTC')
this.cronJobs.set(name, cron)
}

Expand Down
6 changes: 1 addition & 5 deletions src/jobs/JobsRepositoryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 47,8 @@ export class JobsRepositoryImpl implements JobsRepository {
if (process.env.LAYER === Layers.Server) {
Array.from(this.pipelines.keys()).forEach(name => {
const job = this.pipelines.get(name)
console.log('register', job)
if (job !== undefined && job.cron !== undefined) {
cronRegistry.register(name, job.cron, () => {
console.log(name, this.pipelines)
return Promise.resolve()
})
cronRegistry.register(name, job.cron, () => this.run(name).toPromise())
}
})
}
Expand Down

0 comments on commit 6152cd3

Please sign in to comment.