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.
We need to test if the same method defined more than once only register
one subscriber for it. We can safelly remove because the method body is
the same and Subscriber use method_added hook for register the
subscriber.
Before, you were required to attach *after* adding the methods to the
class, since the attachment process needed the methods to be present.
With this change, any new method will also be attached to the configured
namespace.