-
Notifications
You must be signed in to change notification settings - Fork 475
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
Centralised retries() for LogThrDestDriver #204
Centralised retries() for LogThrDestDriver #204
Conversation
log_threaded_dest_driver_stop_watches(self); | ||
if (log_queue_check_items(self->queue, &timeout_msec, | ||
log_threaded_dest_driver_message_became_available_in_the_queue, | ||
self, NULL)) | ||
{ | ||
if (!self->worker.insert(self)) | ||
LogMessage *msg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part should be moved into a separated function.
And this function should use a loop, which loop running while we get message from the queue and the insert method is success. I think it should be more efficient.
Seems good, but please find my comments inline |
Added two more commits that implement the improvements suggested. Can I you review the result again, @juhaszviktor? Thanks! |
Instead of implementing retries() for each driver, implement it once, in LogThrDestDriver. This changes the API of worker->insert: it now receives the message, and must return one of a number of resulting states. The parent class will handle it from there. All derived drivers were updated. This fixes #201, and due to centralization and common behaviour, also fixes #202 too. As a side effect, this adds retries() functionality to amqp(), stomp() and redis(). Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This new rule in the grammar will hold all the options that are centrally implemented by LogThrDestDriver. Currently, this is the retries() option. With the function moved to that class, the setter was moved there too, and all copies were removed from the various drivers. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Now that "retries" is implemented by something in core too, move associated things to cfg-parser. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
In log_threaded_dest_driver_do_insert(), loop while log_queue_pop_head() returns TRUE (or we need to suspend), so that we don't do a sleep/wakeup cycle for every single message. We can do this without blocking anyone else, because this function is running in a dedicated thread. Thanks to Viktor Juhasz for the suggestion! Suggested-by: Viktor Juhasz <viktor.juhasz@balabit.com> Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of locally keeping track of suspension, move that to LogThrDestDriver->suspended, and set that to TRUE in _disconnect_and_suspend(), and back to FALSE in _do_work(). This way the control flow is easier to follow, and re-registering can be moved to _do_work() from _do_insert(). Requested-by: Viktor Juhasz <viktor.juhasz@balabit.com> Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Centralised retries() for LogThrDestDriver
ci: enable indexing and testing stable packages
Moves the
retries()
functionality intoLogThrDestDriver
, and updates all modules that use the class so that they will now supportretries()
too.