All files / src/monitor/tasks TaskCheckProofs.ts

50% Statements 4/8
0% Branches 0/3
0% Functions 0/3
50% Lines 4/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33  28x     28x 28x         28x                                            
import { WalletMonitor } from '../WalletMonitor';
import { WalletMonitorTask } from './WalletMonitorTask';
 
 
export class TaskCheckProofs extends WalletMonitorTask {
    static taskName = 'CheckProofs';
 
    /**
     * Set to true to trigger running this task
     */
    static checkNow = false;
 
    constructor(monitor: WalletMonitor, public triggerMsecs = 1000 * 60 * 60 * 4) {
        super(monitor, TaskCheckProofs.taskName);
    }
 
    trigger(nowMsecsSinceEpoch: number): { run: boolean; } {
        return {
            run: (
                TaskCheckProofs.checkNow ||
                nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch > this.triggerMsecs
            )
        };
    }
 
    async runTask(): Promise<void> {
        TaskCheckProofs.checkNow = false;
 
        //    const r = await checkCompletedWithoutProofs(this.storage)
        //    console.log("CheckProofs", JSON.stringify(r))
    }
}