dfinity / exchange-rate-canister

The exchange rate canister (XRC) makes use of the HTTP requests feature to provide exchange rates as a service to the IC.
Apache License 2.0
37 stars 10 forks source link

`feature`: If timestamp = null and the request is inflight, use the previous minute in hopes to return a rate. #174

Closed dfinity-ryancroote closed 1 year ago

dfinity-ryancroote commented 1 year ago

This PR implements the following:

  1. If the request contains a timestamp = null, the XRC will get the current normalized timestamp.
  2. If the requested assets with the current normalized timestamp are considered to be inflight, the XRC then goes back 1 additional minute (labeled internally as a past normalized timestamp).
  3. If requested assets with the past normalized timestamp are not in the cache, the minimum fee is charged and the caller receives a pending error.
  4. If requested assets with the past normalized timestamp are in the cache, the base cost fee is charged and the caller receives the requested rate.