@@ -22,7 +22,7 @@ import { decrypt } from '../../../utils/crypt.js'
2222import { verifyProviderFees } from '../utils/feesHandler.js'
2323import { Blockchain } from '../../../utils/blockchain.js'
2424import { validateOrderTransaction } from '../utils/validateOrders.js'
25- import { getConfiguration , validUntil5Mins } from '../../../utils/index.js'
25+ import { getConfiguration } from '../../../utils/index.js'
2626import { sanitizeServiceFiles } from '../../../utils/util.js'
2727import { FindDdoHandler } from '../handler/ddoHandler.js'
2828import { ProviderFeeValidation } from '../../../@types/Fees.js'
@@ -429,7 +429,7 @@ export class FreeComputeStartHandler extends CommandHandler {
429429 }
430430 }
431431 let engine = null
432- let validUntil = validUntil5Mins
432+ let validUntil = null
433433 try {
434434 // split compute env (which is already in hash-envId format) and get the hash
435435 // then get env which might contain dashes as well
@@ -475,29 +475,9 @@ export class FreeComputeStartHandler extends CommandHandler {
475475 )
476476 await engine . checkIfResourcesAreAvailable ( task . resources , env , true )
477477 if ( task . validUntil ) {
478- validUntil = task . validUntil
479- if ( env . maxJobDuration && validUntil > env . maxJobDuration ) {
480- CORE_LOGGER . logMessage (
481- 'FreeComputeStartCommand validUntil bigger than supported max duration job: ' +
482- validUntil +
483- ' fallback to supported max duration job: ' +
484- env . maxJobDuration ,
485- true
486- )
487-
488- validUntil = env . maxJobDuration
489- }
490- } else {
491- // If task.validUntil is not provided, use 'env.maxJobDuration' if available
492- if ( env . maxJobDuration ) {
493- CORE_LOGGER . logMessage (
494- 'FreeComputeStartCommand validUntil is null,' +
495- ' fallback to supported max duration job: ' +
496- env . maxJobDuration ,
497- true
498- )
499- validUntil = env . maxJobDuration
500- }
478+ validUntil = env . free . maxJobDuration
479+ ? Math . min ( task . validUntil , env . free . maxJobDuration )
480+ : task . validUntil
501481 }
502482 } catch ( e ) {
503483 console . error ( e )
0 commit comments