Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "Admin UI for Pace",
"license": "AGPL-3.0",
Expand Down
27 changes: 16 additions & 11 deletions apps/api/internal/live/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,31 @@ func twoServers(t *testing.T) (*fakeAPI, *Server, string, *Server, string) {
return api, first, firstAddress, second, secondAddress
}

// waitForSubscription blocks until a server's relay is carrying a document, which is what makes a publish from the other one reach it.
func waitForSubscription(t *testing.T, server *Server, name string) {
// waitForSubscribers blocks until Redis itself reports that `want` relays are carrying a document, which is what makes a publish from one of them reach the others.
//
// Redis is asked rather than the relay because the relay registers a subscription in its own map before Redis has confirmed it: Subscribe only queues the command, and the confirmation it waits for comes several statements later. Polling that map therefore returns while a publish can still be dropped -- pub/sub keeps no backlog, so a message published before the far server is confirmed is not late, it is gone. That window is narrow enough to never open on an idle machine and wide enough to open on a loaded CI runner, which is what made this test flake with zero frames received in ten seconds.
func waitForSubscribers(t *testing.T, server *Server, name string, want int64) {
t.Helper()
channel := documentChannel(name)
deadline := time.Now().Add(5 * time.Second)
var seen int64
for time.Now().Before(deadline) {
server.relay.mu.Lock()
_, subscribed := server.relay.subscriptions[name]
server.relay.mu.Unlock()
if subscribed {
counts, err := server.relay.client.PubSubNumSub(context.Background(), channel).Result()
if err != nil {
t.Fatalf("ask redis who is subscribed to %s: %v", channel, err)
}
seen = counts[channel]
if seen >= want {
return
}
time.Sleep(5 * time.Millisecond)
}
t.Fatalf("the relay never subscribed to %s", name)
t.Fatalf("redis reports %d subscriber(s) on %s after five seconds, want %d", seen, channel, want)
}

// TestAChangeOnOneServerReachesTheOther is the whole reason the relay exists: two people editing one page do not necessarily reach the same server.
func TestAChangeOnOneServerReachesTheOther(t *testing.T) {
_, first, firstAddress, second, secondAddress := twoServers(t)
_, first, firstAddress, _, secondAddress := twoServers(t)

here := dial(t, firstAddress)
here.authenticate(testPageID, "a-user")
Expand All @@ -82,9 +88,8 @@ func TestAChangeOnOneServerReachesTheOther(t *testing.T) {
there.authenticate(testPageID, "a-user")
there.readUntil(hocuspocus.MessageAuth)

// Being authenticated is not the same as being subscribed. The document is taken up after the handshake, on the server's own schedule, and Redis pub/sub keeps no backlog -- so a change published before the far server has confirmed its subscription is not delayed, it is discarded. On a loaded machine that is the whole test: it saw zero frames in ten seconds while both servers were working correctly.
waitForSubscription(t, first, testPageID)
waitForSubscription(t, second, testPageID)
// Being authenticated is not the same as being subscribed. The document is taken up after the handshake, on the server's own schedule, and Redis pub/sub keeps no backlog -- so a change published before the far server has confirmed its subscription is not delayed, it is discarded. On a loaded machine that is the whole test: it saw zero frames in ten seconds while both servers were working correctly. Both servers share one Redis, so one question covers the pair.
waitForSubscribers(t, first, testPageID, 2)

document, err := ydoc.ParseHTML("<p>across the cluster</p>")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion apps/space/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "space",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pace",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "Project management that keeps pace with the work",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/codemods/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/codemods",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"scripts": {
"check:format": "oxfmt --check .",
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/constants",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/editor",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "Core Editor that powers Pace",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/hooks",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "React hooks that are shared across multiple apps internally",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/i18n",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "I18n shared across multiple apps internally",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/propel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/propel",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/services/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/services",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-state/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/shared-state",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "Shared state shared across multiple apps internally",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwind-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/tailwind-config",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "common tailwind configuration across monorepo",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/types",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/typescript-config",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"license": "AGPL-3.0",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/ui",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "UI components shared across multiple apps internally",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pace/utils",
"version": "1.4.44",
"version": "1.4.45",
"private": true,
"description": "Helper functions shared across multiple apps internally",
"license": "AGPL-3.0",
Expand Down
Loading