MCPcopy Create free account
hub / github.com/NextDotID/proof_server / triggerRevalidate

Function triggerRevalidate

controller/proof_query.go:234–259  ·  view source on GitHub ↗
(proofID int64)

Source from the content-addressed store, hash-verified

232}
233
234func triggerRevalidate(proofID int64) error {
235 switch common.CurrentRuntime {
236 case common.Runtimes.Standalone:
237 // Revalidate it in a block way since this func will
238 // be called under goroutine.
239 // FIXME: basiclly duplicated to `cmd/lambda_worker.revalidate_single()`
240 proof := model.Proof{}
241 tx := model.DB.Preload("ProofChain").Preload("ProofChain.Previous").Where("id = ?", proofID).First(&proof)
242 if tx.Error != nil {
243 return xerrors.Errorf("%w", tx.Error)
244 }
245 return proof.Revalidate()
246 case common.Runtimes.Lambda:
247 // Use AWS SQS to send message to workers
248 msg := types.QueueMessage{
249 Action: types.QueueActions.Revalidate,
250 ProofID: proofID,
251 }
252
253 if err := sqs.Send(msg); err != nil {
254 return xerrors.Errorf("Failed to send message to queue: %w", err)
255 }
256 }
257
258 return nil
259}

Callers 2

performProofQueryFunction · 0.85
proofExistsFunction · 0.85

Calls 2

RevalidateMethod · 0.95
SendFunction · 0.92

Tested by

no test coverage detected