fix(server): make system config core singleton (#4392)

* make system config core singleton

* refactor

* fix tests

* chore: fix tests

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Daniel Dietzler
2023-10-09 02:51:03 +02:00
committed by GitHub
parent 66ccf298ba
commit 0243570c0b
15 changed files with 33 additions and 19 deletions
+1 -2
View File
@@ -223,8 +223,7 @@ describe(JobService.name, () => {
it('should subscribe to config changes', async () => {
await sut.registerHandlers(makeMockHandlers(false));
const configCore = new SystemConfigCore(newSystemConfigRepositoryMock());
configCore.config$.next({
SystemConfigCore.create(newSystemConfigRepositoryMock(false)).config$.next({
job: {
[QueueName.BACKGROUND_TASK]: { concurrency: 10 },
[QueueName.CLIP_ENCODING]: { concurrency: 10 },
+1 -1
View File
@@ -21,7 +21,7 @@ export class JobService {
@Inject(ISystemConfigRepository) configRepository: ISystemConfigRepository,
@Inject(IPersonRepository) private personRepository: IPersonRepository,
) {
this.configCore = new SystemConfigCore(configRepository);
this.configCore = SystemConfigCore.create(configRepository);
}
async handleCommand(queueName: QueueName, dto: JobCommandDto): Promise<JobStatusDto> {