-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix registry alive call (#2048)
Ensures that we can hold connections when electric is not ready even if it is not started (useful in multi tenant)
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@core/sync-service": patch | ||
--- | ||
|
||
Assume process is not alive if registry is not alive. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/sync-service/test/electric/process_registry_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
defmodule Electric.ProcessRegistryTest do | ||
use ExUnit.Case, async: true | ||
alias Electric.ProcessRegistry | ||
|
||
@stack_id "foo" | ||
|
||
describe "alive?/2" do | ||
test "should return false for inexistent process" do | ||
{:ok, _} = | ||
ProcessRegistry.start_link( | ||
name: ProcessRegistry.registry_name(@stack_id), | ||
keys: :duplicate, | ||
stack_id: @stack_id | ||
) | ||
|
||
assert false == ProcessRegistry.alive?(@stack_id, "bar") | ||
end | ||
|
||
test "should return false for any process if registry not started" do | ||
assert false == ProcessRegistry.alive?(@stack_id, "bar") | ||
end | ||
end | ||
end |