{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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | currency_1905728_02.patch | 855 bytes | xano |
| #3 | currency_1905728_01.patch | 1.82 KB | xano |
| #1 | currency_1905728_00.patch | 1.96 KB | xano |
Comments
Comment #1
xanoComment #2
xanoComment #3
xanoMinor update to make sure that unavailable rates are not saved to the database.
Comment #4
xanoI'm too fast for my own good.
Comment #5
xanoComment #7
xano