Open whoabuddy opened 1 year ago
DO class that returns from KV or writes inscriptions (replaces current getInscription() functionality)
DO class that indexes all known inscriptions
The first one could be split into more pieces as well if we run into any errors when scaling.
Problem
The inscribe.news API will either return a value from KV, or, fetch the data from Hiro, store it in KV, then return the value.
Each request to the API calls the async function getInscription(), which may be causing a race condition where two simultaneous requests are stepping on each others promises (this post has a good visual and description).
This has happened in the past when multiple indexer instances were running at once, and it used to at least show "This request will never return a response" in the logs, which was not present this time.
The odd state is consistent though, no clear indicates and requests time out with 524 errors after about 1-2 minutes, see #30 as the most recent example.
Solution
This could be mitigated by converting the
getInscription()
helper function to a durable object class, which gives additional functionality: