-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: maintenance mode disables scheduler #3854
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
|
||
return logger; | ||
return { logger, getRecords }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing structure to fix TS errors
const schedulerService = new SchedulerService(logger); | ||
const job = jest.fn(); | ||
|
||
schedulerService.pause(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pause will prevent immediate run and scheduled run
constructor( | ||
{ | ||
patStore, | ||
eventStore, | ||
}: Pick<IUnleashStores, 'patStore' | 'eventStore'>, | ||
config: IUnleashConfig, | ||
settingService: SettingService, | ||
schedulerService: SchedulerService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new explicit dependency so that maintenance mode can affect the scheduler
@@ -51,6 +56,11 @@ export default class MaintenanceService { | |||
setting: MaintenanceSchema, | |||
user: string, | |||
): Promise<void> { | |||
if (setting.enabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the core of the logic for the runtime behavior
} = services; | ||
|
||
if (await maintenanceService.isMaintenanceMode()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the core of the logic for the startup behavior
@@ -43,7 +43,7 @@ async function createApp( | |||
const db = createDb(config); | |||
const stores = createStores(config, db); | |||
const services = createServices(stores, config, db); | |||
scheduleServices(services); | |||
await scheduleServices(services); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting on maintenance mode telling us if it's on/off
@@ -1,12 +1,17 @@ | |||
import { Logger, LogProvider } from '../logger'; | |||
|
|||
export type SchedulerMode = 'active' | 'paused'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scheduler can be in paused mode now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
About the changes
Important files
Discussion points