-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stub for recurring system status check job
- Loading branch information
Showing
6 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
source/SIL.AppBuilder.Portal/node-server/job-executors/systemStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { BullMQ, prisma, DatabaseWrites } from 'sil.appbuilder.portal.common'; | ||
import { Job } from 'bullmq'; | ||
import { ScriptoriaJobExecutor } from './base.js'; | ||
|
||
export class CheckSystemStatuses extends ScriptoriaJobExecutor<BullMQ.ScriptoriaJobType.CheckSystemStatuses> { | ||
async execute(job: Job<BullMQ.CheckSystemStatusesJob, number, string>): Promise<number> { | ||
// TODO: Do I use the `SystemStatus` table? Why does this table even exist? It mostly duplicates data from `Organizations` but is completely disconnected from `Organizations`. Can these be consolidated? | ||
const systems = await prisma.systemStatuses.findMany(); | ||
job.updateProgress(10); | ||
//const timestamp = new Date(); | ||
systems.forEach((s, i) => { | ||
// TODO: Not doing anything here until above TODO is resolved | ||
job.updateProgress(10 + (i+1) * 80 / systems.length); | ||
}); | ||
//await prisma.$transaction(systems.map()); | ||
job.updateProgress(100); | ||
return systems.length; | ||
} | ||
} |