File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { IdentitiesCrudService } from '../identities/identities-crud.service';
1515import { ConfigObjectIdentitiesDTO , ConfigObjectSchemaDTO } from './_dto/config.dto' ;
1616import { Lifecycle , LifecycleRefId } from './_schemas/lifecycle.schema' ;
1717import { ConfigService } from '@nestjs/config' ;
18+ import dayjs from 'dayjs' ;
1819
1920interface LifecycleSource {
2021 [ source : string ] : Partial < ConfigObjectIdentitiesDTO > [ ] ;
@@ -85,6 +86,14 @@ export class LifecycleService extends AbstractServiceSchema implements OnApplica
8586 const job = new CronJob ( cronExpression , this . handleCron . bind ( this , { lifecycleRules } ) ) ;
8687 this . schedulerRegistry . addCronJob ( `lifecycle-trigger` , job ) ;
8788 this . logger . warn ( `Lifecycle trigger cron job scheduled with expression: <${ cronExpression } >` ) ;
89+
90+ job . addCallback ( async ( ) : Promise < void > => {
91+ const now = dayjs ( new Date ( ) ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ;
92+ this . logger . debug ( `Lifecycle trigger cron job executed at <${ now } > !` ) ;
93+
94+ const nextDate = dayjs ( job . nextDate ( ) . toJSDate ( ) ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ;
95+ this . logger . verbose ( `Next execution at <${ nextDate } >` ) ;
96+ } ) ;
8897 job . start ( ) ;
8998
9099 this . logger . log ( 'LifecycleService bootstraped' ) ;
You can’t perform that action at this time.
0 commit comments