Skip to content
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

feat: Make watermill settings configurable #1297

Merged
merged 7 commits into from
Oct 27, 2023
Merged

feat: Make watermill settings configurable #1297

merged 7 commits into from
Oct 27, 2023

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Oct 26, 2023

This adds configuration options for our watermill implementation. For now we only
have a go-channel driver, which is what we've been using until now. This is
also the default.

The first configuration settings this adds for the aforementioned driver as the following:

  • router_close_timeout: per the watermill docs this determines how long router should work for handlers when closing.
  • buffer_size: determines the buffer size for the golang channel the driver is using.

By allowing for setting the buffer size, we allow for paralellization of
request handling of events. We were not setting this before and thus
our event handling was serial.

We should also configure the router_close_timeout to be slightly lower than
the pod's termination grace period in our deployment. A separate PR will make
that setting configurable.

@JAORMX JAORMX changed the title Add parallelization to watermill WIP: Add parallelization to watermill Oct 26, 2023
evankanderson
evankanderson previously approved these changes Oct 26, 2023
@evankanderson
Copy link
Member

I suspect we might want to start with a lower value... do we want to wire this in with the viper configuration?

@JAORMX
Copy link
Contributor Author

JAORMX commented Oct 26, 2023

I'm gonna make this configurable. Let it as WIP until I add it

@JAORMX JAORMX changed the title WIP: Add parallelization to watermill feat: Make watermill settings configurable Oct 27, 2023
This adds configuration options for our watermill implementation. For now we only
have a `go-channel` driver, which is what we've been using until now. This is
also the default.

The first configuration settings this adds for the aforementioned driver as the following:

* `router_close_timeout`: per the watermill docs this determines how long router should work for handlers when closing.
* `buffer_size`: determines the buffer size for the golang channel the driver is using.

By allowing for setting the buffer size, we allow for paralellization of
request handling of events. We were not setting this before and thus
our event handling was serial.

We should also configure the `router_close_timeout` to be slightly lower than
the pod's termination grace period in our deployment. A separate PR will make
that setting configurable.
@JAORMX JAORMX requested a review from rdimitrov October 27, 2023 08:16
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question, but looks good. A smoke test also went fine.

@@ -107,3 +107,8 @@ github:
# [*] for all events. It can also be a list such as [push,branch_protection_rule].
# Please check complete list on https://docs.github.com/es/webhooks-and-events/webhooks/webhook-events-and-payloads
events: ["*"]

events:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have these in the config.yaml? Or are they more of an illustrative example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(All the values are the defaults)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to. But explicit is better than implicit

@JAORMX JAORMX merged commit 2fd5314 into main Oct 27, 2023
12 checks passed
@JAORMX JAORMX deleted the parallel-watermill branch October 27, 2023 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants