update postgresql branch

This commit is contained in:
Ben
2026-05-07 23:45:07 -04:00
parent cc0ca3979e
commit 327be48ade
23 changed files with 8817 additions and 8406 deletions
+26 -1
View File
@@ -162,6 +162,32 @@ export class StratumV1JobsService {
return this.blocks[jobTemplateId];
}
public cleanup(clearJobs: boolean, now: number = Date.now()) {
if (clearJobs) {
this.blocks = {};
this.jobs = {};
return;
}
let templatesDeleted = 0;
let jobsDeleted = 0;
for (const templateId in this.blocks) {
if (now - this.blocks[templateId].blockData.creation > (1000 * 60 * 5)) {
delete this.blocks[templateId];
templatesDeleted++;
}
}
for (const jobId in this.jobs) {
if (now - this.jobs[jobId].creation > (1000 * 60 * 5)) {
delete this.jobs[jobId];
jobsDeleted++;
}
}
//console.log(`Deleted ${templatesDeleted} templates and ${jobsDeleted} jobs.`)
}
public addJob(job: MiningJob) {
this.jobs[job.jobId] = job;
this.latestJobId++;
@@ -178,5 +204,4 @@ export class StratumV1JobsService {
return this.latestJobId.toString(16);
}
}