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

Namespace Redis Connections #349

Merged
merged 8 commits into from
Aug 8, 2024
Merged

Conversation

mattheworris
Copy link
Contributor

@mattheworris mattheworris commented Aug 7, 2024

We want to allow for all services to use the same Redis.

  • Make sure each service has a different Redis connection namespace for non-bull redis connections.
  • Make sure all Bull Queues have unique names via prefixing the queues
  • Note this as a BREAKING change

Services:

  • Graph Service
  • Account Service
  • Content Publishing Service
  • Content Watcher Service

Closes #189

@mattheworris mattheworris linked an issue Aug 7, 2024 that may be closed by this pull request
4 tasks
@mattheworris mattheworris self-assigned this Aug 7, 2024
@mattheworris mattheworris marked this pull request as draft August 7, 2024 23:39
@mattheworris mattheworris changed the title chore: Update Redis cache key prefix in account service Namespace Redis Connections Aug 7, 2024
@mattheworris mattheworris marked this pull request as ready for review August 8, 2024 00:11
Copy link
Contributor

@wilwade wilwade left a comment

Choose a reason for hiding this comment

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

Hmm... The code looks correct, but if I run gateway via ./start-gateway.sh (making sure to clear the volumes first)

I get this which looks wrong. Although not just wrong for the new services, wrong for the ones we thought fixed as well:

$ redis-cli
127.0.0.1:6379> KEYS *
 1) "bull:contentIpfsQueue:meta"
 2) "bull:watchReactionQueue:meta"
 3) "bull:reconnectRequest:wait"
 4) "bull:contentRequestQueue:meta"
 5) "bull:reconnectRequest:3:1:true"
 6) "bull:reconnectRequest:events"
 7) "bull:graphTxMonitorQueue:id"
 8) "bull:watchReactionQueue:id"
 9) "registeredWebhook"
10) "bull:reconnectRequest:6:1:true"
11) "bull:watchBroadcastQueue:events"
12) "GraphUpdateScannerService:lastSeenBlockNumber"
13) "bull:graphChangeRequest:meta"
14) "bull:watchTombstoneQueue:meta"
15) "bull:watchProfileQueue:meta"
16) "bull:graphChangeNotify:meta"
17) "lastSeenBlockNumber"
18) "bull:graphChangePublish:events"
19) "bull:reconnectRequest:id"
20) "bull:graphTxMonitorQueue:meta"
21) "bull:watchReplyQueue:meta"
22) "bull:graphTxMonitorQueue:events"
23) "bull:graphUpdateQueue:id"
24) "bull:watchReplyQueue:events"
25) "bull:graphUpdateQueue:events"
26) "bull:reconnectRequest:4:1:true"
27) "bull:reconnectRequest:meta"
28) "bull:watchReplyQueue:id"
29) "bull:watchBroadcastQueue:meta"
30) "bull:reconnectRequest:marker"
31) "bull:contentIpfsQueue:events"
32) "bull:reconnectRequest:5:1:true"
33) "bull:watchBroadcastQueue:id"
34) "bull:graphUpdateQueue:meta"
35) "bull:watchReactionQueue:events"
36) "bull:graphChangePublish:meta"
37) "bull:reconnectRequest:2:1:true"
38) "bull:watchUpdateQueue:meta"
39) "GraphUpdateCompletionMonitorService:lastSeenBlockNumber"
40) "bull:contentIpfsQueue:id"

@mattheworris
Copy link
Contributor Author

Hmm... The code looks correct, but if I run gateway via ./start-gateway.sh (making sure to clear the volumes first)

I get this which looks wrong. Although not just wrong for the new services, wrong for the ones we thought fixed as well:

$ redis-cli
127.0.0.1:6379> KEYS *
 1) "bull:contentIpfsQueue:meta"
 2) "bull:watchReactionQueue:meta"
 3) "bull:reconnectRequest:wait"
 4) "bull:contentRequestQueue:meta"
 5) "bull:reconnectRequest:3:1:true"
 6) "bull:reconnectRequest:events"
 7) "bull:graphTxMonitorQueue:id"
 8) "bull:watchReactionQueue:id"
 9) "registeredWebhook"
10) "bull:reconnectRequest:6:1:true"
11) "bull:watchBroadcastQueue:events"
12) "GraphUpdateScannerService:lastSeenBlockNumber"
13) "bull:graphChangeRequest:meta"
14) "bull:watchTombstoneQueue:meta"
15) "bull:watchProfileQueue:meta"
16) "bull:graphChangeNotify:meta"
17) "lastSeenBlockNumber"
18) "bull:graphChangePublish:events"
19) "bull:reconnectRequest:id"
20) "bull:graphTxMonitorQueue:meta"
21) "bull:watchReplyQueue:meta"
22) "bull:graphTxMonitorQueue:events"
23) "bull:graphUpdateQueue:id"
24) "bull:watchReplyQueue:events"
25) "bull:graphUpdateQueue:events"
26) "bull:reconnectRequest:4:1:true"
27) "bull:reconnectRequest:meta"
28) "bull:watchReplyQueue:id"
29) "bull:watchBroadcastQueue:meta"
30) "bull:reconnectRequest:marker"
31) "bull:contentIpfsQueue:events"
32) "bull:reconnectRequest:5:1:true"
33) "bull:watchBroadcastQueue:id"
34) "bull:graphUpdateQueue:meta"
35) "bull:watchReactionQueue:events"
36) "bull:graphChangePublish:meta"
37) "bull:reconnectRequest:2:1:true"
38) "bull:watchUpdateQueue:meta"
39) "GraphUpdateCompletionMonitorService:lastSeenBlockNumber"
40) "bull:contentIpfsQueue:id"

I will check it out. I would bet that the docker-compose.yaml needs to be updated to have the correct values for CACHE_KEY_PREFIX and maybe the defaults are not set correctly.

@JoeCap08055
Copy link
Contributor

@mattheworris I think you missed adding CACHE_KEY_PREFIX to the Joi config in env.config.ts and giving it a default. That's what I did in content-watcher and graph

@mattheworris
Copy link
Contributor Author

redis keys look good now:

# redis-cli
127.0.0.1:6379> KEYS *
 1) "content-publishing::bull:broadcastQueue:stalled-check"
 2) "content-publishing::bull:assetQueue:meta"
 3) "account-service:TxnNotifierService:lastSeenBlockNumber"
 4) "content-publishing::bull:requestQueue:completed"
 5) "content-watcher::bull:contentRequestQueue:events"
 6) "content-publishing::bull:replyQueue:stalled-check"
 7) "content-publishing::bull:publishQueue:f3e28fd6-1709-459c-8782-b3fffb1ccd98"
 8) "content-publishing::bull:batchQueue:id"
 9) "content-publishing::bull:broadcastQueue:meta"
10) "graph-service::bull:graphChangePublish:meta"
11) "content-watcher::bull:watchBroadcastQueue:meta"
12) "content-publishing::bull:transactionReceiptQueue:0xa5ab6c09d80ef79d588c3ea57923d5ef1db084ad2d7b9400391bb0dff81ad665"
13) "content-watcher::bull:watchUpdateQueue:stalled-check"
14) "graph-service::bull:graphChangeRequest:stalled-check"
15) "graph-service::bull:graphChangeRequest:meta"
16) "account-service:epochCapacity:0"
17) "content-publishing::bull:publishQueue:meta"
18) "content-watcher::bull:watchReplyQueue:meta"
19) "content-publishing::bull:profileQueue:stalled-check"
20) "content-watcher:registeredWebhook"
21) "graph-service::bull:graphChangeNotify:stalled-check"
22) "content-publishing::bull:transactionReceiptQueue:events"
23) "content-watcher::bull:watchUpdateQueue:meta"
24) "account-service::bull:transactionPublish:1SvZ71iBfDuSIc0AJvl7IEe_F74"
25) "graph-service::bull:graphChangeNotify:meta"
26) "account-service::bull:transactionPublish:meta"
27) "content-publishing::bull:reactionQueue:meta"
28) "content-watcher::bull:contentIpfsQueue:meta"
29) "content-publishing::bull:publishQueue:id"
30) "content-publishing::bull:tombstoneQueue:stalled-check"
31) "content-publishing::bull:broadcastQueue:completed"
32) "content-watcher::bull:watchProfileQueue:meta"
33) "content-publishing::bull:batchQueue:stalled-check"
34) "content-publishing::bull:batchQueue:completed"
35) "content-publishing::bull:publishQueue:completed"
36) "content-watcher::bull:watchTombstoneQueue:stalled-check"
37) "content-watcher::bull:contentRequestQueue:meta"
38) "content-publishing::bull:requestQueue:meta"
39) "content-publishing::bull:batchQueue:events"
40) "account-service::bull:transactionPublish:completed"
41) "content-publishing::bull:transactionReceiptQueue:completed"
42) "content-publishing::bull:profileQueue:meta"
43) "content-publishing::bull:broadcastQueue:--RgU6LmPYhrN219bdKB0i39-P8"
44) "content-publishing::bull:requestQueue:stalled-check"
45) "content-watcher::bull:contentRequestQueue:stalled-check"
46) "content-publishing::bull:statusQueue:meta"
47) "account-service::bull:transactionPublish:id"
48) "content-publishing::bull:broadcastQueue:events"
49) "graph-service::bull:graphChangePublish:events"
50) "content-watcher::bull:watchTombstoneQueue:meta"
51) "content-publishing::bull:requestQueue:events"
52) "account-service::bull:transactionPublish:events"
53) "content-watcher::bull:contentRequestQueue:id"
54) "content-watcher::bull:watchReplyQueue:stalled-check"
55) "content-publishing:epochCapacity:0"
56) "content-publishing::bull:publishQueue:events"
57) "graph-service::bull:reconnectRequest:meta"
58) "content-publishing::bull:broadcastQueue:id"
59) "content-watcher::bull:watchProfileQueue:stalled-check"
60) "content-watcher::bull:watchBroadcastQueue:stalled-check"
61) "account-service::bull:transactionPublish:stalled-check"
62) "content-publishing::bull:tombstoneQueue:meta"
63) "content-publishing::bull:batchQueue:meta"
64) "content-publishing::bull:batchQueue:f3e28fd6-1709-459c-8782-b3fffb1ccd98"
65) "content-publishing::bull:transactionReceiptQueue:meta"
66) "content-watcher::bull:contentIpfsQueue:stalled-check"
67) "content-publishing::bull:updateQueue:meta"
68) "content-publishing::bull:requestQueue:--RgU6LmPYhrN219bdKB0i39-P8"
69) "content-watcher::bull:watchReactionQueue:meta"
70) "content-publishing:schema:2"
71) "content-publishing::bull:requestQueue:id"
72) "content-publishing::bull:reactionQueue:stalled-check"
73) "content-publishing::bull:replyQueue:meta"
74) "content-watcher::bull:watchReactionQueue:stalled-check"
75) "content-publishing::bull:updateQueue:stalled-check"
76) "content-publishing::bull:publishQueue:stalled-check"
77) "content-publishing::bull:assetQueue:stalled-check"
78) "content-publishing::bull:transactionReceiptQueue:id"
79) "content-publishing::bull:transactionReceiptQueue:stalled-check"
80) "graph-service::bull:graphChangePublish:stalled-check"
81) "content-watcher:eventsToWatch:8cdb9942-5ded-4949-9f95-3a8fdbc7e5ac"

Copy link
Contributor

@wilwade wilwade left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Thanks!

Copy link
Contributor

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

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

nit: mind going through & making the default prefix consistent across all services vis-a-vis appending -service or not? (including the ones that already had the prefix)

@mattheworris mattheworris merged commit c4372bf into main Aug 8, 2024
9 checks passed
@mattheworris mattheworris deleted the 189-namespace-redis-connections branch August 8, 2024 20:03
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.

Namespace Redis Connections
3 participants