forked from discourse/message_bus
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
middleware tracing #5
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fuller interface documentation
* turn off message bus by rails railtie when running rake * don't initialize middleware subscribed when off * method to detect if message bus is off
* do not crash when calling after_fork on destroyed bus * do not crash on calling destroy twice
Allows preventing MessageBus start-up
This puts the burden of writing change-logs on the contributor rather than the release manager, reducing the effort to cut a release and improving the accuracy of the changelog. It also means that changelog entries from now on are more likely to be useful in git blame when looking for the actual change that produced them.
Pending permission to bump gem.
``` # frozen_string_literal: true require_relative '../rerunner/rerunner' require 'benchmark/ips' def append(global_id,message_id,channel,data) global_id.to_s << "|" << message_id.to_s << "|" << channel.gsub("|", "$$123$$") << "|" << data end def interpolate(global_id,message_id,channel,data) "#{global_id}|#{message_id}|#{channel.gsub("|", "$$123$$")}|#{data}" end if interpolate(1,2,"a|b","data") != append(1,2,"a|b","data") raise "bad implementation" end Benchmark.ips do |x| x.warmup = 1 x.time = 10 x.report("<<") do |times| while times > 0 append(1,2,"three","four") times -= 1 end end x.report("interpolate") do |times| while times > 0 interpolate(1,2,"three","four") times -= 1 end end x.compare! end ``` ``` Calculating ------------------------------------- << 2.254M (± 1.0%) i/s - 22.619M in 10.036563s interpolate 2.398M (± 0.9%) i/s - 24.143M in 10.067638s Comparison: interpolate: 2398259.8 i/s <<: 2253830.6 i/s - 1.06x slower ``` Also fixed discourse#227
When a user attempts to publish to a an empty group/user or client id list odds are a mistake happened. Erring on the side of safety we should publish nothing, previously everyone would get the message.
Ruby 2.4 has reached EOL.
The thread may be dead before `Thread#wakeup` is called.
On the redis backend, any errors encountered during `MessageBus#publish` will add the message into an in memory queue and silently swallow the error. While this is behavior is OK for normal message_bus usage, it may lead to inconsistency when using `DistributedCache`. If a process doesn't publish successfully to another process, it will still update its in memory cache leaving the other processes unaware. As such, the distributed cache is out of sync and will require another successful write to the cache to resync all the caches.
…nager. This is a partial revert of e91d414. Instead of changing the default behavior of what `MessageBus::DistributedCache::Manager#publish` should do when it is called on a Readonly redis, this commit introduces an option to change the behavior.
Also added test to prevent this regression.
Previously a visibility change was only inconsistently forcing a poll. This happened cause "delayPollTimeout" may have been in effect during the change. This should make the polling after returning to a tab more consistent. However we may go even a bit further later on by binding to scroll or mouse click.
turns out that unmoderated public chat is a bad idea.
In a consuming application, when debugging slow responses to subscribing clients, it is useful to know where time is being spent in MessageBus middleware. This functionality allows hooking in a consumer-application-specific tracing mechanism, such as [NewRelic's `#trace_execution_scoped`](https://www.rubydoc.info/github/newrelic/newrelic-ruby-agent/NewRelic/Agent/MethodTracer#trace_execution_scoped-instance_method).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
is_readonly?
method compatible with the redis gem both pre and post v4.0 when theclient
attribute was removed - closes Use ofRedis#client
method which was removed in redis v4.0 discourse/message_bus#208user_ids
andgroup_ids
MessageBus#register_client_message_filter
MessageBus.base_route
MessageBus::TimerThread
.queue_in_memory
option not being passed to the backends.MessageBus::DistributedCache#publish
should raise on error.publish_queue_in_memory
option to distributed cache manager.