feat: accept uploads into staging with jobs, outbox and job processor
This commit is contained in:
@@ -5,6 +5,7 @@ import { S3Service } from './storage/s3.service';
|
||||
|
||||
const DEFAULT_GRACE_SECONDS = 3600;
|
||||
const DEFAULT_INTERVAL_SECONDS = 300;
|
||||
const DEFAULT_STAGING_RETENTION_SECONDS = 86400;
|
||||
|
||||
function option(name: string, fallback: number): number {
|
||||
const prefix = `--${name}=`;
|
||||
@@ -23,6 +24,10 @@ async function main(): Promise<void> {
|
||||
const loop = process.argv.includes('--loop');
|
||||
const graceSeconds = option('grace-seconds', DEFAULT_GRACE_SECONDS);
|
||||
const intervalSeconds = option('interval-seconds', DEFAULT_INTERVAL_SECONDS);
|
||||
const stagingRetentionSeconds = option(
|
||||
'staging-retention-seconds',
|
||||
Number(process.env.STAGING_RETENTION_SECONDS ?? DEFAULT_STAGING_RETENTION_SECONDS),
|
||||
);
|
||||
const prisma = new PrismaService();
|
||||
const s3 = new S3Service();
|
||||
do {
|
||||
@@ -30,6 +35,7 @@ async function main(): Promise<void> {
|
||||
const report = await reconcile(prisma, s3, {
|
||||
apply,
|
||||
graceMs: graceSeconds * 1000,
|
||||
stagingRetentionMs: stagingRetentionSeconds * 1000,
|
||||
});
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user