Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/core/compute/startCompute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,13 @@ export class PaidComputeStartHandler extends CommandHandler {
agreementId: '',
resources
}
const jobId = createHash('sha256').update(JSON.stringify(s)).digest('hex')
// job ID unicity
const timestamp =
BigInt(Date.now()) * 1_000_000n + (process.hrtime.bigint() % 1_000_000n)
const random = Math.random()
const jobId = createHash('sha256')
.update(JSON.stringify(s) + timestamp.toString() + random.toString())
.digest('hex')
// let's calculate payment needed based on resources request and maxJobDuration
const cost = engine.calculateResourcesCost(
task.payment.resources,
Expand Down
Loading