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

Unleash / unleash-edge / #1280 / 1
79%
main: 79%

Build:
DEFAULT BRANCH: main
Ran 12 Dec 2024 09:24AM UTC
Files 26
Run time 1s
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.1

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)

1285 of 1799 relevant lines covered (71.43%)

1.7 hits per line

Source Files on job #1280.1
  • Tree
  • List 0
  • Changed 18
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 1280
  • f5112874 on github
  • Prev Job for on main (##1271.1)
  • Next Job for on main (##1281.1)
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