We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b01f32 commit 2de1a4fCopy full SHA for 2de1a4f
1 file changed
src/components/core/compute/startCompute.ts
@@ -352,7 +352,13 @@ export class PaidComputeStartHandler extends CommandHandler {
352
agreementId: '',
353
resources
354
}
355
- const jobId = createHash('sha256').update(JSON.stringify(s)).digest('hex')
+ // job ID unicity
356
+ const timestamp =
357
+ BigInt(Date.now()) * 1_000_000n + (process.hrtime.bigint() % 1_000_000n)
358
+ const random = Math.random()
359
+ const jobId = createHash('sha256')
360
+ .update(JSON.stringify(s) + timestamp.toString() + random.toString())
361
+ .digest('hex')
362
// let's calculate payment needed based on resources request and maxJobDuration
363
const cost = engine.calculateResourcesCost(
364
task.payment.resources,
0 commit comments