1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

Merge pull request #588 from oceanprotocol/fix/issue583-start-second-job

Fix/Start a second compute job after first successful attempt
This commit is contained in:
Bogdan Fazakas 2021-05-17 17:38:16 +03:00 committed by GitHub
commit 0954613b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -359,7 +359,8 @@ export default function Compute({
Logger.log('[compute] Starting compute job response: ', response) Logger.log('[compute] Starting compute job response: ', response)
setHasPreviousDatasetOrder(true) await checkPreviousOrders(selectedAlgorithmAsset)
await checkPreviousOrders(ddo)
setIsPublished(true) setIsPublished(true)
} catch (error) { } catch (error) {
setError('Failed to start job!') setError('Failed to start job!')

View File

@ -121,11 +121,10 @@ export async function getPreviousOrders(
if (assetTimeout === '0') { if (assetTimeout === '0') {
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
} else { } else {
const expiry = new BigNumber( const expiry =
fetchedPreviousOrders?.data?.tokenOrders[0]?.timestamp fetchedPreviousOrders?.data?.tokenOrders[0]?.timestamp * 1000 +
).plus(assetTimeout) Number(assetTimeout) * 1000
const unixTime = new BigNumber(Math.floor(Date.now() / 1000)) if (Date.now() <= expiry) {
if (unixTime.isLessThan(expiry)) {
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
} else { } else {
return null return null