-
Notifications
You must be signed in to change notification settings - Fork 297
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
chore: cleanup notifier #3867
chore: cleanup notifier #3867
Conversation
…dder-server into chore.pg-notifier-clean-up
…dder-server into chore.pg-notifier-clean-up
…re.pg-notifier-clean-up
…re.pg-notifier-clean-up+metadata
…dder-server into chore.pg-notifier-clean-up
…re.pg-notifier-clean-up
…re.pg-notifier-clean-up
…re.pg-notifier-clean-up
…re.pg-notifier-clean-up
f46d21e
to
d7be64c
Compare
d7be64c
to
c6841f1
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3867 +/- ##
==========================================
- Coverage 68.98% 68.97% -0.01%
==========================================
Files 351 352 +1
Lines 52816 52971 +155
==========================================
+ Hits 36435 36538 +103
- Misses 14067 14117 +50
- Partials 2314 2316 +2
☔ View full report in Codecov by Sentry. |
n.config.host = n.conf.GetString("PGNOTIFIER_DB_HOST", "localhost") | ||
n.config.user = n.conf.GetString("PGNOTIFIER_DB_USER", "ubuntu") | ||
n.config.database = n.conf.GetString("PGNOTIFIER_DB_NAME", "ubuntu") | ||
n.config.port = n.conf.GetInt("PGNOTIFIER_DB_PORT", 5432) | ||
n.config.password = n.conf.GetString("PGNOTIFIER_DB_PASSWORD", "ubuntu") | ||
n.config.sslMode = n.conf.GetString("PGNOTIFIER_DB_SSL_MODE", "disable") | ||
n.config.maxAttempt = n.conf.GetInt("PgNotifier.maxAttempt", 3) | ||
n.config.maxOpenConnections = n.conf.GetInt("PgNotifier.maxOpenConnections", 20) | ||
n.config.shouldForceSetLowerVersion = n.conf.GetBool("SQLMigrator.forceSetLowerVersion", true) | ||
n.config.trackBatchInterval = n.conf.GetDuration("PgNotifier.trackBatchIntervalInS", 2, time.Second) | ||
n.config.queryTimeout = n.conf.GetDuration("Warehouse.pgNotifierQueryTimeout", 5, time.Minute) |
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.
why not:
n.config.host = n.conf.GetString("PGNOTIFIER_DB_HOST", "localhost") | |
n.config.user = n.conf.GetString("PGNOTIFIER_DB_USER", "ubuntu") | |
n.config.database = n.conf.GetString("PGNOTIFIER_DB_NAME", "ubuntu") | |
n.config.port = n.conf.GetInt("PGNOTIFIER_DB_PORT", 5432) | |
n.config.password = n.conf.GetString("PGNOTIFIER_DB_PASSWORD", "ubuntu") | |
n.config.sslMode = n.conf.GetString("PGNOTIFIER_DB_SSL_MODE", "disable") | |
n.config.maxAttempt = n.conf.GetInt("PgNotifier.maxAttempt", 3) | |
n.config.maxOpenConnections = n.conf.GetInt("PgNotifier.maxOpenConnections", 20) | |
n.config.shouldForceSetLowerVersion = n.conf.GetBool("SQLMigrator.forceSetLowerVersion", true) | |
n.config.trackBatchInterval = n.conf.GetDuration("PgNotifier.trackBatchIntervalInS", 2, time.Second) | |
n.config.queryTimeout = n.conf.GetDuration("Warehouse.pgNotifierQueryTimeout", 5, time.Minute) | |
n.config = config{ | |
host: n.conf.GetString("PGNOTIFIER_DB_HOST", "localhost") | |
user: n.conf.GetString("PGNOTIFIER_DB_USER", "ubuntu") | |
database: n.conf.GetString("PGNOTIFIER_DB_NAME", "ubuntu") | |
.... |
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 will require creating a new standalone struct which I am not sure is required here. We are okay with an anonymous structure here.
services/notifier/model/notifier.go
Outdated
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.
I would suggest the following structure:
moving this file to notifier/notifier.go
containing models part of a the common interface, shared between multiple implementations. Having to access them from model package seems a bit counter intuitive for a library.
move notifier/notifier.go
-> notifier/pgnotifer.go
and instead of notifier.New() -> notifier.NewPG() -- since it a specific implementation.
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.
moving this file to notifier/notifier.go containing models part of a the common interface, shared between multiple implementations. Having to access them from model package seems a bit counter intuitive for a library.
Makes sense. Since it's a package, it should provide a single interface for accessing it. I was initially targeting a repo package and since this model will be shared so moved models to a separate package. Moving everything to the notifier package.
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.
move notifier/notifier.go -> notifier/pgnotifer.go and instead of notifier.New() -> notifier.NewPG() -- since it a specific implementation
I am not sure whether the consumers need to be aware of the implementation details like whether it is implemented for Postgres, Pulsar, or something else.
8aa056c
to
fb87b8d
Compare
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.
I left a bunch of questions 🙂
c77c27e
to
6ef6694
Compare
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.
Good stuff 😎 👍
Description
notifier
instead ofpgNotifier
since we don't need to expose the implementation details like it is implemented for Postgres.notifier.Init()
.background errgroup
to gracefully shut down the goroutines being created during track batch and subscribe.Linear Ticket
Security