wallet-storage-client
Version:
Client only Wallet Storage
43 lines • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskReviewStatus = void 0;
const WalletMonitorTask_1 = require("./WalletMonitorTask");
/**
* Notify Transaction records of changes in ProvenTxReq records they may have missed.
*
* The `notified` property flags reqs that do not need to be checked.
*
* Looks for aged Transactions with provenTxId with status != 'completed', sets status to 'completed'.
*
* Looks for reqs with 'invalid' status that
*/
class TaskReviewStatus extends WalletMonitorTask_1.WalletMonitorTask {
constructor(monitor, triggerMsecs = 1000 * 60 * 15, agedMsecs = 1000 * 60 * 5) {
super(monitor, TaskReviewStatus.taskName);
this.triggerMsecs = triggerMsecs;
this.agedMsecs = agedMsecs;
}
trigger(nowMsecsSinceEpoch) {
return {
run: (this.triggerMsecs > 0 && nowMsecsSinceEpoch - this.lastRunMsecsSinceEpoch > this.triggerMsecs)
};
}
async runTask() {
let log = '';
const agedLimit = new Date(Date.now() - this.agedMsecs);
const r = await this.storage.runAsStorageProvider(async (sp) => {
const r = await sp.reviewStatus({ agedLimit });
return r;
});
if (r.log.length > 0)
log += `${r.log}`;
return log;
}
}
exports.TaskReviewStatus = TaskReviewStatus;
TaskReviewStatus.taskName = 'ReviewStatus';
/**
* Set to true to trigger running this task
*/
TaskReviewStatus.checkNow = false;
//# sourceMappingURL=TaskReviewStatus.js.map