Add a new before_server_bind event that is published before a runner's run method is called via the CLI.
A new helper method for {before,after}_server_bind on the Protobuf module.
Example:
Protobuf.before_server_bind do
eager_load_some_data_only_when_server_starts!
end
Protobuf.after_server_bind do
report_server_online!
end
I also considered adding these to the Protobuf::Rpc::Server module since it's more specific to the use-case, but felt like the root Protobuf was "good enough" so please let me know if you have a strong preference either way.
We currently have the ability to subscribe to callbacks via:
This proposes 2 changes:
before_server_bind
event that is published before a runner'srun
method is called via the CLI.Example:
I also considered adding these to the
Protobuf::Rpc::Server
module since it's more specific to the use-case, but felt like the rootProtobuf
was "good enough" so please let me know if you have a strong preference either way.cc @liveh2o @abrandoned