fix(core): update

This commit is contained in:
Philipp Kunz 2023-08-15 19:55:22 +02:00
parent 7c9f27e02f
commit 8166d2f7c2
5 changed files with 397 additions and 320 deletions

View File

@ -30,8 +30,8 @@
"@push.rocks/smartrx": "^3.0.6", "@push.rocks/smartrx": "^3.0.6",
"@push.rocks/smartstring": "^4.0.7", "@push.rocks/smartstring": "^4.0.7",
"@push.rocks/smarttime": "^4.0.5", "@push.rocks/smarttime": "^4.0.5",
"@push.rocks/smartunique": "^3.0.3", "@push.rocks/smartunique": "^3.0.6",
"@push.rocks/taskbuffer": "^3.1.3", "@push.rocks/taskbuffer": "^3.1.5",
"@tsclass/tsclass": "^4.0.42", "@tsclass/tsclass": "^4.0.42",
"mongodb": "^5.7.0" "mongodb": "^5.7.0"
}, },

703
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,7 @@ tap.test('SmartdataDistributedCoordinator should update distributed task request
const mockTaskRequest: taskbuffer.distributedCoordination.IDistributedTaskRequest = { const mockTaskRequest: taskbuffer.distributedCoordination.IDistributedTaskRequest = {
submitterId: "mockSubmitter12345", // Some unique mock submitter ID submitterId: "mockSubmitter12345", // Some unique mock submitter ID
requestResponseId: 'uni879873462hjhfkjhsdf', // Some unique ID for the request-response
taskName: "SampleTask", taskName: "SampleTask",
taskVersion: "1.0.0", // Assuming it's a version string taskVersion: "1.0.0", // Assuming it's a version string
taskExecutionTime: Date.now(), taskExecutionTime: Date.now(),

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartdata', name: '@push.rocks/smartdata',
version: '5.0.28', version: '5.0.29',
description: 'do more with data' description: 'do more with data'
} }

View File

@ -174,7 +174,7 @@ export class SmartdataDistributedCoordinator extends plugins.taskbuffer.distribu
}); });
console.log(`bidding for leadership...`); console.log(`bidding for leadership...`);
await plugins.smartdelay.delayFor( await plugins.smartdelay.delayFor(
plugins.smarttime.getMilliSecondsFromUnits({ seconds: 20 }) plugins.smarttime.getMilliSecondsFromUnits({ seconds: 5 })
); );
await this.asyncExecutionStack.getExclusiveExecutionSlot(async () => { await this.asyncExecutionStack.getExclusiveExecutionSlot(async () => {
let biddingInstances = await DistributedClass.getInstances({}); let biddingInstances = await DistributedClass.getInstances({});
@ -182,7 +182,7 @@ export class SmartdataDistributedCoordinator extends plugins.taskbuffer.distribu
(instanceArg) => (instanceArg) =>
instanceArg.data.status === 'bidding' && instanceArg.data.status === 'bidding' &&
instanceArg.data.lastUpdated >= instanceArg.data.lastUpdated >=
Date.now() - plugins.smarttime.getMilliSecondsFromUnits({ seconds: 25 }) Date.now() - plugins.smarttime.getMilliSecondsFromUnits({ seconds: 6 })
); );
console.log(`found ${biddingInstances.length} bidding instances...`); console.log(`found ${biddingInstances.length} bidding instances...`);
this.ownInstance.data.elected = true; this.ownInstance.data.elected = true;
@ -234,9 +234,12 @@ export class SmartdataDistributedCoordinator extends plugins.taskbuffer.distribu
console.error('instance need to be started first...'); console.error('instance need to be started first...');
return; return;
} }
await this.ownInstance.updateFromDb();
this.ownInstance.data.taskRequests.push(taskRequestArg); this.ownInstance.data.taskRequests.push(taskRequestArg);
await this.ownInstance.save(); await this.ownInstance.save();
}); });
await plugins.smartdelay.delayFor(10000);
return null; return null;
} }