{currency_conversion_rate_db_table} is filled during cron by asking all converters to load all rates they have to offer. While this works for CurrencyConverterFixedRates (which can provide all its rates with very little effort), a number of popular web services that provide real-time rates, only allow clients to retrieve one rate per HTTP request. Yahoo! Finance, for instance, offers 152 currencies. Requesting every possible rate would result in 23104 HTTP requests.

Instead, find a way to fill the database table with specific rates only. Currency 1 allows site admins to configure lists of N 'from' currencies and M 'to' currencies. The table would then be filled by N*M rates, which for converters like Yahoo! will also result in N*M requests. Adding this 'filter' to the module's configuration would actually make filling the table with Yahoo! (for instance) possible. The change itself would be a small one. The existing configuration page can be extended with two select elements, and variable_*() can be used for storage. The hook_cron() implementation has to call CurrencyConverter::loadMultiple(), rather than CurrencyConverter::loadAll().

We might even want to remove CurrencyConverterInterface::loadAll() completely, because only a limited number of converters will be able to implement that method.

Comments

xano’s picture

Assigned: Unassigned » xano
Status: Active » Needs review
StatusFileSize
new1.96 KB
xano’s picture

Status: Needs review » Fixed
xano’s picture

Status: Fixed » Needs review
StatusFileSize
new1.82 KB

Minor update to make sure that unavailable rates are not saved to the database.

xano’s picture

StatusFileSize
new855 bytes

I'm too fast for my own good.

xano’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xano’s picture

Assigned: xano » Unassigned