local-ch / lhc

🚀 Advanced HTTP Client for Ruby. Fueled with interceptors.
GNU General Public License v3.0
43 stars 1 forks source link

Mitigate Race Condition when initialising Prometheus #169

Closed scan closed 4 years ago

scan commented 4 years ago

The setting of the registering is not atomic, so it could happen that on start up, the registered flag is not yet set when a second thread initialises the Prometheus interceptor again. Simply adding a rescue for this case prevents an exception.

This should be idiomatic anyway.