• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Unleash / unleash-edge / #1280
79%

Build:
DEFAULT BRANCH: main
Ran 12 Dec 2024 09:24AM UTC
Jobs 1
Files 26
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Dec 2024 09:20AM UTC coverage: 71.429% (-3.9%) from 75.315%
#1280

push

web-flow
experimental: sse client support (#592)

> ⚠️ This is experimental and a work in progress

## Overview

tl;dr: This is a very experimental implementation of streaming in Edge: it both listens to the experimental Unleash streaming endpoint and pushes updates to any listeners subscribing to Edge (in effect mirroring the Unleash endpoint). All related code is behind the "streaming" feature gate.

More detail:

I have added an event source client to the `features_refresher` file. If the streaming flag is on, we'll spawn a task that takes care of listening to Unleash for events instead of starting the poll loop for flags.

There is a new endpoint at `api/client/streaming` (mirroring the Unleash endpoint) that you can hit to start listening for updates.

The updates are handled by a new `broadcaster` module (largely stolen from [this Actix example](https://github.com/actix/examples/blob/master/server-sent-events/src/broadcast.rs)).

The broadcaster stores its client in a hash map that uses the flag query as the key and maps it to a vec of clients that use the same query.

## Left to do

Regarding the implementation: I'm not very familiar with Actix, and I haven't done a whole lot of async / multithreaded rust before, so there's probably gonna be a whole lot of things that we can improve, from the architecture level to the specific data structures used. 

~~Also, due to the very time-limited spike we did, we need to actually do some real error handling. There's a good few places where we either ignore errors or would just panic if we ever encountered them.~~

But aside from that, there's a few other things to do too:
- [x] Store the streaming url in the urls struct
- [ ] Add fetch mode streaming/polling as a CLI option
- [ ] The broadcaster needs to store the token used with each client; not just the query (you can have multiple tokens with the same query and those tokens can be invalidated separately)
- [ ] We should probably find ... (continued)

52 of 157 new or added lines in 4 files covered. (33.12%)

1285 of 1799 relevant lines covered (71.43%)

1.7 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #1280.1 12 Dec 2024 09:24AM UTC 0
71.43
Source Files on build #1280
Detailed source file information is not available for this build.
  • Back to Repo
  • f5112874 on github
  • Prev Build on main
  • Next Build on main
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc