visoft / ruby_odata

OData Consumer for Ruby
http://bit.ly/IntroRubyOData
MIT License
107 stars 52 forks source link

Not thread safe #43

Closed dotboris closed 2 years ago

dotboris commented 10 years ago

This gem is not thread safe. This because of the way queries are built and executed.

If between the time you build a query and the time you execute said query another thread starts building a query. The new one overwrites the first one.

Here's an example.

There is a shared instance of OData::Service Thread A starts building a query. Thread B is given CPU time. Thread B builds a query. Thread B executes the last query. Query B gets executed. Thread A regains control. Thread A executes the last query. Query B gets executed.

In this example, the first query (A) never gets executed and the second query (B) gets executed twice.