-
-
Notifications
You must be signed in to change notification settings - Fork 401
fix: scope postgres cdc syn registry #1594
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
Conversation
| users_scope_shards = Env.get_integer("USERS_SCOPE_SHARDS", 5) | ||
| postgres_cdc_scope_shards = Env.get_integer("POSTGRES_CDC_SCOPE_SHARDS", 5) |
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.
Do you think we should document this as part of the README?
| @@ -0,0 +1,21 @@ | |||
| defmodule Realtime.Syn.PostgresCdc do | |||
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.
:nitpick: Should this be scoped (no pun intended) like this Extensions.PostgresCdcRls.Syn instead? No strong opinion tbh as this is highly subjective.
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 want to do something similar for Connect so probably will keep them all together so we can abstract more syn stuff
lib/realtime/syn/connect.ex
Outdated
| @moduledoc """ | ||
| Scope for the PostgresCdc module. | ||
| """ | ||
| require Logger |
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.
Do we need this Logger?
lib/realtime/syn/connect.ex
Outdated
| """ | ||
| @spec scope(String.t()) :: atom() | ||
| def scope(tenant_id) do | ||
| shards = Application.get_env(:realtime, :postgres_cdc_scope_shards) |
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.
Should we make this a fetch_env! and fail badly if not defined as nil here will not go well I think?
lib/realtime/syn/connect.ex
Outdated
| end | ||
|
|
||
| def scopes() do | ||
| shards = Application.get_env(:realtime, :postgres_cdc_scope_shards) |
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.
same here
| scope = Atom.to_string(scope) | ||
|
|
||
| case scope do | ||
| "realtime_postgres_cdc_" <> _ -> |
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.
:nitpick: What if we keep this as part of the Syn module you created and not expose the prefix here?
@postgres_cdc_scope_prefix Realtime.Syn.PostgresCdc.scope_prefix
case scope do
@postgres_cdc_scope_prefix <> _ ->
...
lib/realtime/syn_handler.ex
Outdated
|
|
||
| def on_process_unregistered(scope, name, pid, _meta, reason) do | ||
| case Atom.to_string(scope) do | ||
| "realtime_postgres_cdc_" <> _ = scope -> |
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.
same here
edgurgel
left a comment
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.
Added some comments. LGTM
012181d to
205963a
Compare
| | POSTGRES_CDC_SCOPE_SHARDS | number | Number of dynamic supervisor partitions used by the Postgres CDC extension. Defaults to 5. | | ||
| | USERS_SCOPE_SHARDS | number | Number of dynamic supervisor partitions used by the Users extension. Defaults to 5. | |
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 think the description is wrong here
|
🎉 This PR is included in version 2.57.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
scope postgres cdc syn registry