Flagsmith / Flagsmith/flagsmith-rust-client

Provide a sync + non-blocking API when server-side evaluation is enabled

Open
#54 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
8
Forks
7
Avg merge
1d 16h
Merged PRs (30d)
3

Description

We'd like to use this SDK in a variety of different services were performance matters. We almost only use it with local side evaluation and in different contexts, sync, async and sometimes in async contexts but with manual future implementation, for example when implementing tower services (https://docs.rs/tower-service/latest/tower_service/).

It appears that if server side evaluation is enabled there is no need to do any fetch eagerly. Cf this related code:
```rust
if flagsmith.options.enable_local_evaluation {
// Update environment once...
if let Err(e) = update_environment(&client, &ds, &environment_url) {
log::warn!("Failed to fetch environment on initialization: {}. Will retry in background.", e);
}
```
with `update_environment` writing to the the `eval_context`.

It would be nice if we could split this API between local evaluation and remote evaluation because they do not actually have the same bounds. And local could work in any contexts without sync/async issues.

I'd be happy to discuss this and eventually work on this if this direction is accepted.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the initialization path around flagsmith.options.enable_local_evaluation, update_environment, and eval_context. Compare the local-evaluation and server-side evaluation paths and define what synchronous and non-blocking APIs should expose; done means server-side evaluation no longer requires an eager fetch while local evaluation remains usable in sync and async contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.