mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
logging
This commit is contained in:
@@ -111,19 +111,24 @@ export class StratumV1JobsService {
|
|||||||
this.blocks = {};
|
this.blocks = {};
|
||||||
this.jobs = {};
|
this.jobs = {};
|
||||||
}else{
|
}else{
|
||||||
|
let templatesDeleted = 0;
|
||||||
|
let jobsDeleted = 0;
|
||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
// Delete old templates (5 minutes)
|
// Delete old templates (5 minutes)
|
||||||
for(const templateId in this.blocks){
|
for(const templateId in this.blocks){
|
||||||
if(now - this.blocks[templateId].blockData.creation > (1000 * 60 * 5)){
|
if(now - this.blocks[templateId].blockData.creation > (1000 * 60 * 5)){
|
||||||
delete this.blocks[templateId];
|
delete this.blocks[templateId];
|
||||||
|
templatesDeleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete old jobs (5 minutes)
|
// Delete old jobs (5 minutes)
|
||||||
for (const jobId in this.jobs) {
|
for (const jobId in this.jobs) {
|
||||||
if(now - this.jobs[jobId].creation > (1000 * 60 * 5)){
|
if(now - this.jobs[jobId].creation > (1000 * 60 * 5)){
|
||||||
delete this.jobs[jobId];
|
delete this.jobs[jobId];
|
||||||
|
jobsDeleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(`Deleted ${templatesDeleted} templates and ${jobsDeleted} jobs.`)
|
||||||
}
|
}
|
||||||
this.blocks[data.blockData.id] = data;
|
this.blocks[data.blockData.id] = data;
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user