toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.89k stars 368 forks source link

Use Chewy.thread_local_data to access Thread.current #804

Closed bolshakov closed 3 years ago

bolshakov commented 3 years ago

Currently, it's dangerous to use Chewy with dry-effects, because it runs fibers that reset Thread local state. This PR isolates thread-local variables access, so it could be easily extended.

After isolating them, we can provide dry-effects integration.

See https://github.com/dry-rb/dry-effects/issues/82 for the details.

Before submitting the PR make sure the following are checked: