Migration from expiresAt to fetchedAt (optimistic results)

TL;DR

  1. data considered as fresh when it's not older than

    1. was: 5 minutes

    2. now: 1 minute

  2. stale data handling:

    1. was: completely removed from cache and never returned from API

    2. now: returned from API even if it's stale, but fetching of new data initiated immediately

  3. was: all items in data array had expiresAt field that indicated when server will consider data as stale and will refresh it from blockchain. After that you could re-request fresh data.

  4. now: all items in data array have fetchedAt field that indicates when server received data from blockchain. Once 1 minute since it transpires, you can consider data as stale and re-request it.

Why: data mappings change rarely. Results from hour ago and even from week ago will 99% be accurate. So we return stale from API just to provide a fast initial response, but at the same time we trigger refresh of our caches and when you re-request data in second or two, data will be absolitutely fresh. BUT these second or two really matter when it comes to UX.

Async endpoints

In async version of API now you will immediately receive last fetched bindings for requested domain/address. If some bindings are aged more than 1 minute, system will begin automatic data updating. After ~2-3 sec from first request you can rerequest data and obtain fresh bindings. About completness and processedVendors - previously was linked with data field and represented from how many and from what vendors data are included in response. Now to fit optimistic results concept completness and processedVendors only include vendors with data aged max 1 minute.

It means if you request data from following vendors: ens, lens and sid, the response will looks like this (the new approach):

{
  "data": [
    {
      "domain": "nick.eth",
      "vendor": "ens",
      "fetchedAt": 1691049786092
    }, {
      "domain": "some.domain.sid",
      "vendor": "sid",
      "fetchedAt": 1691049000000
    },{
      "domain": "arachnid.lens",
      "vendor": "lens",
      "fetchedAt": 1691049786092
    }
  ],
  "completeness": 0.666666666666666667,
  "processedVendors": [
    "ens",
    "lens"
  ]
}

Please note that completeness is not 1, this means that some data is too old and can be used only for “readonly” mode and now our system is already updating data from corresponding vendors. You can evaluate fetchedAt field to see which records are actually outdated – the value will be older than 1 minute ago. Now see example of response for same request and same context of data fresness, but from expiresAt concept (the old approach):

{
  "data": [
    {
      "domain": "nick.eth",
      "vendor": "ens"
    }, {
      "domain": "arachnid.lens",
      "vendor": "lens"
    }
  ],
  "expiresAt": 1691049786155,
  "completeness": 0.666666666666666667,
  "processedVendors": [
    "ens",
    "lens"
  ]
}

Sync endpoints

Previously you received fullfilled response (means with data from all requested vendors) with data aged max 5 minutes. Now data is aged max to 1 minute.

Last updated