mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
trigger check previous order after starting a compute job
This commit is contained in:
parent
6cc268bd3f
commit
e73d140012
@ -136,6 +136,7 @@ export default function Compute({
|
|||||||
timeout.toString()
|
timeout.toString()
|
||||||
)
|
)
|
||||||
const assetType = ddo.findServiceByType('metadata').attributes.main.type
|
const assetType = ddo.findServiceByType('metadata').attributes.main.type
|
||||||
|
console.log('checkPreviousOrders asset ' + assetType + ' id= ', orderId)
|
||||||
if (assetType === 'algorithm') {
|
if (assetType === 'algorithm') {
|
||||||
setPreviousAlgorithmOrderId(orderId)
|
setPreviousAlgorithmOrderId(orderId)
|
||||||
setHasPreviousAlgorithmOrder(!!orderId)
|
setHasPreviousAlgorithmOrder(!!orderId)
|
||||||
@ -430,7 +431,10 @@ export default function Compute({
|
|||||||
|
|
||||||
Logger.log('[compute] Starting compute job response: ', response)
|
Logger.log('[compute] Starting compute job response: ', response)
|
||||||
|
|
||||||
setHasPreviousDatasetOrder(true)
|
// setHasPreviousDatasetOrder(true)
|
||||||
|
// setHasPreviousAlgorithmOrder(true)
|
||||||
|
checkPreviousOrders(selectedAlgorithmAsset)
|
||||||
|
checkPreviousOrders(ddo)
|
||||||
setIsPublished(true)
|
setIsPublished(true)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError('Failed to start job!')
|
setError('Failed to start job!')
|
||||||
|
@ -75,14 +75,18 @@ export async function getPreviousOrders(
|
|||||||
variables
|
variables
|
||||||
)
|
)
|
||||||
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
|
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
|
||||||
|
console.log('order fetchedPreviousOrders', fetchedPreviousOrders?.data)
|
||||||
if (assetTimeout === '0') {
|
if (assetTimeout === '0') {
|
||||||
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
||||||
} else {
|
} else {
|
||||||
const expiry = new BigNumber(
|
console.log(
|
||||||
|
'order timestamp',
|
||||||
fetchedPreviousOrders?.data?.tokenOrders[0]?.timestamp
|
fetchedPreviousOrders?.data?.tokenOrders[0]?.timestamp
|
||||||
).plus(assetTimeout)
|
)
|
||||||
const unixTime = new BigNumber(Math.floor(Date.now() / 1000))
|
const expiry =
|
||||||
if (unixTime.isLessThan(expiry)) {
|
fetchedPreviousOrders?.data?.tokenOrders[0]?.timestamp * 1000 +
|
||||||
|
Number(assetTimeout) * 1000
|
||||||
|
if (Date.now() <= expiry) {
|
||||||
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
Loading…
Reference in New Issue
Block a user