aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications/fanout.rb
Commit message (Collapse)AuthorAgeFilesLines
* Keep cache for strings in notifications/fanoutJohn Hawthorn2019-02-011-3/+5
| | | | | | | | | When adding/removing a subscription with a string pattern, it isn't necessary to clear the entire cache, only the cache for the key being added. When adding/removing subscriptions for a regex or to match all events, the full cache is still cleared.
* Make Notifications::Fanout#listeners_for fasterJohn Hawthorn2019-02-011-5/+18
| | | | | | | | | | Previously we stored all subscribers in an array, and every time a new message name came in asked each subscriber if they responded to the message. This commit changes Fanout to hash subscribers with a String pattern by their pattern. This way we can look them up directly and only do the O(N) scan over the non-string (Regex or any) patterns.
* fix arity check to use "parameters" for backwards compatAaron Patterson2018-07-261-4/+9
|
* Always subscribe to event objects via `AS::Notifications.subscribe`Aaron Patterson2018-07-261-12/+7
| | | | | | | We don't need to have a special subscribe method for objects. The regular `subscribe` method is more expensive than a specialized method, but `subscribe` should not be called frequently. If that turns out to be a hotspot, we can introduce a specialized method. :)
* Subscribe to event objects via `subscribe_event`Aaron Patterson2018-07-261-0/+38
| | | | | | Fanout notifier can send event objects to subscribers now. Also moved `end` lower in the `finish!` method to guarantee that CPU time is shorter than real time.
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-1/+1
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Subscribing to notifications while inside the said instrumented section.thedarkone2015-11-281-2/+2
| | | | | | | | | | | | | The issue is that on the exit from Instrumenter#instrument section, an Evented listener will run into an error because its thread local (Thread.current[:_timestack]) has not been set up by the #start method (this obviously happens because the Evented listeners didn't exist at the time, since no subscribtion to that section was made yet). Note: support for subscribing to instrumented sections, while being inside those instrumented sections, might be removed in the future. Maybe fixes #21873.
* Require only necessary concurrent-ruby classes.Jerry D'Antonio2015-11-041-1/+1
|
* Replaced `ThreadSafe::Map` with successor `Concurrent::Map`.Jerry D'Antonio2015-09-191-3/+3
| | | | | | | The thread_safe gem is being deprecated and all its code has been merged into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly the same as its predecessor except for fixes to two bugs discovered during the merge.
* :nodoc: internal class [ci skip]Godfrey Chan2015-08-101-1/+1
|
* Avoid looping through subscribers when unsubscribing with a subscriber object.Guo Xiang Tan2014-06-011-5/+10
|
* Update documentation to reflect unsubscription with name.Guo Xiang Tan2014-06-011-2/+2
|
* use a thread local rather than a queue so events are in the right orderAaron Patterson2013-10-301-7/+4
|
* use a queue rather than a list. fixes #12069Aaron Patterson2013-10-281-1/+1
|
* Bug fix: Evented notification subscribers can handle published eventsCarl Lerche2013-05-171-0/+7
|
* Replace some global Hash usages with the new thread safe cache.thedarkone2012-12-141-2/+5
| | | | | | | | | | | | | | | | Summary of the changes: * Add thread_safe gem. * Use thread safe cache for digestor caching. * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation. * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache. * Use TS::Cache to avoid the synchronisation overhead on listener retrieval. * Replace synchronisation with TS::Cache usage. * Use a preallocated array for performance/memory reasons. * Update the controllers cache to the new AS::Dependencies::ClassCache API. The original @controllers cache no longer makes much sense after @tenderlove's changes in 7b6bfe84f3 and f345e2380c. * Use TS::Cache in the connection pool to avoid locking overhead. * Use TS::Cache in ConnectionHandler.
* Evented notifications take priority over Timed notificationsEric Saxby2012-08-111-3/+3
| | | | | | | 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.
* move fanout back to a global variable, add a mutex for safetyAaron Patterson2012-06-191-7/+17
|
* subscribers are per thread, so remove the nested hash accessAaron Patterson2012-06-191-5/+3
|
* documenting concurrency rules for the Fanout classAaron Patterson2012-06-191-0/+3
|
* evented listeners can subscribe to any messageAaron Patterson2012-03-211-9/+27
|
* evented subscribers workAaron Patterson2012-03-211-6/+10
|
* start / finish events are sent by the instrumenterAaron Patterson2012-03-211-4/+38
|
* split subscribers based on pattern typeAaron Patterson2012-03-211-13/+31
|
* Remove deprecation from AS::Deprecation behavior, some minor cleanupsCarlos Antonio da Silva2012-03-161-4/+3
| | | | | | | | | * Refactor log subscriber, use select! to avoid a new object * Remove deprecation messages related to AS::Deprecation behavior This was added about 2 years ago for Rails 3: https://github.com/rails/rails/commit/d4c7d3fd94e5a885a6366eaeb3b908bb58ffd4db * Remove some not used requires * Refactor delegate to avoid string conversions and if statements inside each block
* minor changesVijay Dev2011-04-271-3/+3
|
* Performance optimizations to handle cases of instrumentors that are not ↵Carlhuda2010-07-221-3/+8
| | | | listened to. Also, fix a possible concurrency issue.
* Minor performance improvment in notifications/fanout and ↵Daniel Guettler2010-07-191-7/+5
| | | | active_record/log_subscriber [#5098 state:open]
* avoid call to Array#firstAaron Patterson2010-07-191-3/+3
|
* subscriber does not need to be a block, but an object that responds to #callAaron Patterson2010-07-181-5/+5
|
* tap the subscriber for easier return valueAaron Patterson2010-07-181-2/+3
|
* bind method is not needed, so goodbye! <3 <3 <3Aaron Patterson2010-07-181-7/+1
|
* drained? is never calledAaron Patterson2010-07-171-4/+0
|
* private method is not neededAaron Patterson2010-07-171-12/+2
|
* removing Binding classAaron Patterson2010-07-171-14/+4
|
* use === to avoid regular expression creation, and speed up string comparisonAaron Patterson2010-07-171-9/+3
|
* allow unsubscribe by name or subscription [#4433 state:resolved]David Chelimsky2010-04-241-5/+15
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Mark bang instrumentations as something that you shuold not be listening to.José Valim2010-03-171-1/+1
|
* Optimize AS::Notifications to remember which subscribers don't match and not ↵Carlhuda2010-03-011-3/+12
| | | | run them. This will allow notifications that are only useful in dev or testing to run efficiently in production.
* You can unsubscribe a subscriberCarlhuda2010-03-011-3/+8
|
* AS::Subscriber is not a LogSubscriberCarlhuda2010-03-011-2/+2
|
* Rename Rails::Subscriber to Rails::LogSubscriberPrem Sichanugrist2010-02-161-5/+5
|
* Remove instrument! and require thread from AS::Notifications.José Valim2010-02-041-3/+1
|
* Default to sync instrumentation.José Valim2010-01-211-33/+3
|
* Notifications: synchronous fanout queue pushes events to subscribers rather ↵Jeremy Kemper2009-11-291-22/+39
| | | | than having them concurrently pull