[ 
https://issues.apache.org/jira/browse/SOLR-15883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17467966#comment-17467966
 ] 

Jan Høydahl commented on SOLR-15883:
------------------------------------

Thanks for contributing to Solr. Also see comment in PR. You are doing great as 
a first-time contributor. For the future, it would perhaps be beneficial to 
seek feedback on the proposed solution in Jira before doing the PR. I think 
perhaps an Executor approach is better since it is 100% back-compat, and it 
would also be a solution for environments where you commit every second, i.e. 
high indexing rate.

For the long term, I think perhaps this FieldType is a good candidate for a 
Solr package, so it no longer is in solr-core, but can be installed separately 
for those who need it. But that is for another day.

> OpenExchangeRatesOrgProvider downloads currencies during a search request and 
> can cause a request timeout
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-15883
>                 URL: https://issues.apache.org/jira/browse/SOLR-15883
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Arkadiusz Robiński
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> In OpenExchangeRatesOrgProvider.java there is a method getExchangeRate which 
> is called during a search request, when a currency convertion is needed (eg. 
> when filtering or sorting by a field of type solr.CurrencyFieldType). Before 
> it returns the exchange rate, it calls reloadIfExpired(), which checks if the 
> configured amount of time passed since the last reload and then fetches data 
> from openexchangerates.org. If there is any delay (eg. the 
> openexchangerates.org server takes long to respond), it will just wait for 
> the response and block the thread. Maybe there is a timeout, but still, it 
> will block a search thread until it timeouts. If timeAllowed is used in the 
> search request, the request will end with an error when timeAllowed passes.
> Also, I don't see any locks or any synchronization there, so I think it tries 
> to download the exchange rates in every search thread that uses a currency 
> field. If there is an outage of openexchangerates.org, all search requests 
> are blocked until openexchangerates.org is available again.
> There should be an option to have the currency rates downloaded in a thread 
> that is not related to a search request.
> One idea for a fix is to have an option to reload exchange rates when a new 
> searcher is opened, similarly to ExternalFileFieldReloader.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to