Commit Graph

19 Commits

Author SHA1 Message Date
Jean Boussier acd462fc23 Only wrap subscriber exceptions if there is more than one
Ref: https://github.com/rails/rails/pull/43282
Ref: https://github.com/rails/rails/pull/43561

It can be legitimate for subscriber to want to bubble up some exception
to the caller, so wrapping it change the exception class which might break
the calling code expecting a specific error.

We can minimize this by only using InstrumentationSubscriberError
when more than one subscriber raised.
2021-11-02 16:47:37 +01:00
Theo Julienne 8f76cca3d9 Ensure we guard against all exceptions, not just StandardError 2021-10-04 23:07:50 +00:00
Theo Julienne 8afcbb6f21 Guard against subscriber exceptions in ActiveSupport::Notifications 2021-09-22 02:07:45 +00:00
Jean Boussier 091dc78f94 Forward sql.active_record notifications back into the calling thread
It is not uncommon for `sql.active_record` subscribers to rely on
thread local or fiber local state. For instance the `buffered-logger`
gem buffer the logs in a thread variable.

With the introduction of async queries, the `sql.active_record`
events can now be produced from a background thread and that break
some expectations.

This makes it hard for subscriber to map the event to the request
or job that scheduled it.

That is why I believe we should instead store the event and
publish it back on the calling thread when the results are
accessed.
2021-03-03 10:33:37 +01:00
Michael Grosser 203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00
Ali Ibrahim 1b7ef40db5 Update AS::Notifications::Instrumenter#instrument
* Update #instrument to make passing a block optional. This will let users
    leverage #instrument for messaging in addition to instrumentation.
2019-03-22 10:01:18 -04:00
zvkemp 94f8e8c8f7 use a proxy matcher for AS::N fanout 2019-02-11 16:04:25 -08:00
Daniel Colson 82c39e1a0b Use assert_empty and assert_not_empty 2018-01-25 23:32:59 -05:00
Koichi ITO ac717d65a3 [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
Kir Shatrov 72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Rafael Mendonça França fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria 5c315a8fa6 modernizes hash syntax in activesupport 2016-08-06 19:38:33 +02:00
Xavier Noria a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
stopdropandrew a007800a55 ActiveSupport::Notifications::Instrumenter#instrument should yield
its payload the same way that ActiveSupport::Notifications does.
Fix spelling in test name.
2013-03-02 16:05:05 -08:00
Aaron Patterson 56f3d05f47 adding start / finish on the instrumenter, adding tests for the class 2013-01-09 15:34:58 -08:00
Eric Saxby 6fe36ba585 Evented notifications take priority over Timed notifications
In cases where a notification subscriber includes methods to support
both Evented and Timed events, Evented should take priority over Timed.
This allows subscribers to be backwards compatible (older Rails only
allows Timed events) while defaulting to newer behavior.
2012-08-11 17:39:20 -07:00
Aaron Patterson ea482d366a oops, forgot to commit the tests! 💣 2012-03-23 11:47:42 -07:00