mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
fix(insight): lazily initialize route preferences
This commit is contained in:
1 parent
a2e66d07da
commit
502b781024
1 file changed
+5
-2
@@ -17,8 +17,11 @@ type GlobalInsightRouteContext = Pick<
|
||||
Pick<ServiceRouteContext, 'globalInsightService' | 'timeInvestmentService' | 'preferencesManager'>
|
||||
|
||||
export function registerGlobalInsightRoutes(server: FastifyInstance, ctx: GlobalInsightRouteContext): void {
|
||||
const preferences = ctx.preferencesManager ?? new PreferencesManager(ctx.pathProvider.getSystemDir())
|
||||
const getExcludedSessionIds = () => preferences.load().ownerExcludedSessionIds
|
||||
let preferences = ctx.preferencesManager
|
||||
const getExcludedSessionIds = () => {
|
||||
preferences ??= new PreferencesManager(ctx.pathProvider.getSystemDir())
|
||||
return preferences.load().ownerExcludedSessionIds
|
||||
}
|
||||
const service =
|
||||
ctx.globalInsightService ??
|
||||
createGlobalInsightService({
|
||||
|
||||
Reference in new issue
Block a user