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

Add poll plugin #425

Merged
merged 10 commits into from
Oct 1, 2024
Merged

Add poll plugin #425

merged 10 commits into from
Oct 1, 2024

Conversation

dfarr
Copy link
Member

@dfarr dfarr commented Sep 21, 2024

GET localhost:8002/default/608f05ad-115c-4943-b0ba-36be92be8fa8
data: {"href":{"claim":"...","complete":"...","heartbeat":"..."},"task":{"id":"1","counter":1,...}}

data: {"href":{"claim":"...","complete":"...","heartbeat":"..."},"task":{"id":"1","counter":2,...}}

data: {"href":{"claim":"...","complete":"...","heartbeat":"..."},"task":{"id":"1","counter":3,...}}

The polling plugin exposes a server that communicates via SSE over a persistent http connection. Once a connection is established it is left open until either:

  1. the server closes the connection
  2. the client disconnects

When a connection is established, the connecting process declares a group an an id by route parameters. A group is persistent and an id is intended to be an ephemeral, for example a uuid. The polling plugin sends a message to a connection, if an applicable connection is available. Messages are preferentially routed to:

  1. A connection with the same group and id as the message
  2. A connection with the same group, but different id; if multiple connections are possible one is chosen at random

Finally, if a connection with the same (group, id) as a pre-existing connection is established it is assumed to be an attempt to reestablish the connection and replaces the previous connection (the server will close it). This is intentionally done to mitigate the possibility that the server could maintain a connection that the client has abandoned.

Copy link

codecov bot commented Sep 21, 2024

Codecov Report

Attention: Patch coverage is 48.73905% with 1931 lines in your changes missing coverage. Please review.

Project coverage is 57.11%. Comparing base (85cf02d) to head (db42a48).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/app/subsystems/api/grpc/pb/promise.pb.go 30.24% 545 Missing and 4 partials ⚠️
internal/app/subsystems/api/grpc/pb/schedule.pb.go 35.19% 230 Missing and 2 partials ⚠️
internal/app/subsystems/api/grpc/pb/task.pb.go 34.12% 220 Missing and 2 partials ⚠️
internal/app/subsystems/api/grpc/pb/lock.pb.go 38.58% 154 Missing and 2 partials ⚠️
...ternal/app/subsystems/api/grpc/pb/callback_t.pb.go 21.79% 118 Missing and 4 partials ⚠️
...nternal/app/subsystems/api/grpc/pb/promise_t.pb.go 26.17% 109 Missing and 1 partial ⚠️
...ternal/app/subsystems/api/grpc/pb/schedule_t.pb.go 29.24% 74 Missing and 1 partial ⚠️
internal/app/subsystems/api/grpc/pb/callback.pb.go 40.00% 70 Missing and 2 partials ⚠️
cmd/config/config.go 0.00% 48 Missing ⚠️
internal/app/plugins/poll/poll.go 76.04% 37 Missing and 9 partials ⚠️
... and 30 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #425      +/-   ##
==========================================
+ Coverage   55.96%   57.11%   +1.14%     
==========================================
  Files         119      115       -4     
  Lines       10919    11561     +642     
==========================================
+ Hits         6111     6603     +492     
- Misses       4383     4495     +112     
- Partials      425      463      +38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dfarr dfarr merged commit e46733c into main Oct 1, 2024
5 of 6 checks passed
@dfarr dfarr deleted the feature/plugin-poll branch October 1, 2024 05:19
@dfarr dfarr mentioned this pull request Oct 1, 2024
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.

1 participant