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)
setHasPreviousDatasetOrder(true)
await checkPreviousOrders(selectedAlgorithmAsset)
await checkPreviousOrders(ddo)
setIsPublished(true)
} catch (error) {
setError('Failed to start job!')

View File

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