-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: check for missing payload #77
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I created an implementation plan which makes the service stateless in exchange for an additional field in the database to keep track of when the last time was when we tried to fetch a payload. Please let me know what you think. |
…hub.com/filecoin-station/deal-observer into nhaimerl-piece-indexer-missing-payloads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, I think we're almost there.
@@ -79,7 +79,9 @@ export async function storeActiveDeals (activeDeals, pgPool) { | |||
term_start_epoch, | |||
term_min, | |||
term_max, | |||
sector_id | |||
sector_id, | |||
payload_retrievability_state, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
payload_retrievability_state, | |
payload_retrievability, |
(everything stored in Postgres is a state)
If you want to annotate the type, maybe instead this?
payload_retrievability_state, | |
payload_retrievability_enum, |
I suggest we wait for @bajtos with this one
@@ -0,0 +1,4 @@ | |||
CREATE TYPE PAYLOAD_RETRIEVABILITY_STATE AS ENUM ('PAYLOAD_CID_NOT_QUERIED_YET', 'PAYLOAD_CID_UNRESOLVED', 'PAYLOAD_CID_RESOLVED','PAYLOAD_CID_TERMINALLY_UNRETRIEVABLE'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CREATE TYPE PAYLOAD_RETRIEVABILITY_STATE AS ENUM ('PAYLOAD_CID_NOT_QUERIED_YET', 'PAYLOAD_CID_UNRESOLVED', 'PAYLOAD_CID_RESOLVED','PAYLOAD_CID_TERMINALLY_UNRETRIEVABLE'); | |
CREATE TYPE PAYLOAD_RETRIEVABILITY_STATE AS ENUM ('PAYLOAD_CID_RESOLUTION_NOT_ATTEMPTED_YET', 'PAYLOAD_CID_UNRESOLVED', 'PAYLOAD_CID_RESOLVED','PAYLOAD_CID_TERMINALLY_UNRETRIEVABLE'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So as not to introduce another concept of "querying"
const PayloadRetrievabilityState = { | ||
NotQueried: 'PAYLOAD_CID_NOT_QUERIED_YET', | ||
Unresolved: 'PAYLOAD_CID_UNRESOLVED', | ||
Resolved: 'PAYLOAD_CID_RESOLVED', | ||
TerminallyUnretrievable: 'PAYLOAD_CID_TERMINALLY_UNRETRIEVABLE' | ||
} | ||
|
||
const PayloadRetrievabilityStateType = Type.Enum(PayloadRetrievabilityState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const PayloadRetrievabilityState = { | |
NotQueried: 'PAYLOAD_CID_NOT_QUERIED_YET', | |
Unresolved: 'PAYLOAD_CID_UNRESOLVED', | |
Resolved: 'PAYLOAD_CID_RESOLVED', | |
TerminallyUnretrievable: 'PAYLOAD_CID_TERMINALLY_UNRETRIEVABLE' | |
} | |
const PayloadRetrievabilityStateType = Type.Enum(PayloadRetrievabilityState) | |
const PayloadRetrievabilityStates = { | |
NotQueried: 'PAYLOAD_CID_NOT_QUERIED_YET', | |
Unresolved: 'PAYLOAD_CID_UNRESOLVED', | |
Resolved: 'PAYLOAD_CID_RESOLVED', | |
TerminallyUnretrievable: 'PAYLOAD_CID_TERMINALLY_UNRETRIEVABLE' | |
} | |
const PayloadRetrievabilityState = Type.Enum(PayloadRetrievabilityStates) |
Does this make more sense? Payload Retrievability States lists all possible states. Payload Retrievability State is one of these states at a time.
We might want to wait for @bajtos with this one
if (deal.last_payload_retrieval_attempt) { | ||
deal.payload_retrievability_state = PayloadRetrievabilityState.TerminallyUnretrievable | ||
} else { | ||
deal.payload_retrievability_state = PayloadRetrievabilityState.Unresolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so nice to read :)
await updatePayloadCidInActiveDeal(pgPool, deal) | ||
deal.payload_cid = await getDealPayloadCid(minerPeerId, deal.piece_cid) | ||
if (!deal.payload_cid) { | ||
if (deal.last_payload_retrieval_attempt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (deal.last_payload_retrieval_attempt) { | |
if (deal.payload_retrievability_state === PayloadRetrievabilityState.Unresolved) { |
@bajtos I'm merging now so that we can hopefully get more payloads assigned over the weekend, and thereby improve Spark DDO data |
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This PR adds the following changes:
See also this issue.