Skip to content
  • Edouard CHIN's avatar
    dc522a3e
    Fix active record instrumentation not thread safe: · dc522a3e
    Edouard CHIN authored
    - When using Active Record async feature, the instrumentation was
      not thread safe.
    
      ```ruby
      Post.count_async
    
      ActiveSupport::Notifications.subscribed(->(*) { }, "active_record.sql") do
        Post.count
      end
      ```
    
      With the right race condition, the subscription would never fire up.
      This is due to temporarly overriding the instrumentation instance
      variable on the connection.
    dc522a3e
    Fix active record instrumentation not thread safe:
    Edouard CHIN authored
    - When using Active Record async feature, the instrumentation was
      not thread safe.
    
      ```ruby
      Post.count_async
    
      ActiveSupport::Notifications.subscribed(->(*) { }, "active_record.sql") do
        Post.count
      end
      ```
    
      With the right race condition, the subscription would never fire up.
      This is due to temporarly overriding the instrumentation instance
      variable on the connection.
Loading