You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
Currently when the source API's are down the CurrencyConversion supervisor does not start because the UpdateWorker is not started.
Would it be possible to start the CurrencyConversion process using the seed data in this case? In this case the UpdateWorker would need to keep retrying to fetch the rates from the source instead of stopping.
The text was updated successfully, but these errors were encountered:
@rauann I'm not sure how much I like that idea. There's a few libraries like for example ex_cldr or tzdata that include some seed and then refresh that in a given interval.
However: those libraries operate on a lot more static datasets. Currency data is basically outdated a minute after it was loaded.
I would consider an approach that works along the following lines:
An optional function can be supplied when starting CurrencyConversion. That function returns the initial data and a DateTime when that data is from. (This means that the user is concerned himself to supply starting data.)
The UpdateWorker is seeded with that data.
The UpdateWorker has a setting max_data_age
If the UpdateWorker refresh fails, it does the following:
If data refresh date is newer than max_age_ms: Log Error and retry later
If it is older: crash with the refresh error
If there's no data (for example when starting and no seed was provided): crash with the refresh error
This will allow you to provide your own data, set a max_age_ms to a value that you're fine with.
The default should be no seed and max_age_ms so that one refresh can fail.
I do not have the time to implement this, but I would for sure merge a PR that implements this.
@maennchen No problem, enjoy your vacation :) ... About the suggested approach you did, I was looking at the scenario that I am trying to solve in my project and realized that have seed data for currencies rates is not a good idea because as you said, they will be easily outdated, also, have a config that defines how long this seed would be valid does not help too much since I would end up having to change this config constantly.
What do you think about to make possible to define more than one source for the currencies? One would behave as a fallback source in the case where the primary one is not available. Looking at how the UpdateWorker works, I think it could be implemented.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently when the source API's are down the
CurrencyConversion
supervisor does not start because theUpdateWorker
is not started.Would it be possible to start the
CurrencyConversion
process using theseed
data in this case? In this case theUpdateWorker
would need to keep retrying to fetch the rates from the source instead of stopping.The text was updated successfully, but these errors were encountered: