Skip to content

Conversation

@unbalancedparentheses
Copy link
Contributor

Summary

Add comprehensive tests and documentation for the Backend enum.

Tests (10 new tests)

  • Backend enum traits (Default, Copy, Clone, Debug, PartialEq, Eq)
  • All three backends handle call/cast correctly
  • Backend::Thread isolates blocking work from async runtime
  • Multiple backends can run concurrently with independent state
  • Backend::default() works in start()

Documentation

  • Comparison table: execution model, best use cases, limitations
  • Code examples for each backend
  • "When to Use" guide with advantages and when to avoid

~300 lines

Dependencies

⚠️ Merge after PR #105

Test plan

  • All 26 tests pass

🤖 Generated with Claude Code

@unbalancedparentheses unbalancedparentheses changed the title test: add Backend enum tests and documentation [2/8] [2/9] docs: add Backend enum tests and documentation Jan 10, 2026
/// - Should not compete with other blocking tasks
/// - Run CPU-intensive workloads
///
/// Each GenServer gets its own thread, providing complete isolation from
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is not true: GenServer::start(Backend::Thread) uses GenServerHandle::new_on_thread which end's up creating a new Runtime (currently a tokio Runtime) in a dedicated OS thread. While this isolates it from other tasks in other threads, it still needs the async runtime. And I believe it currently needs some fine tuning and testing, as it is started via Runtime::new() which creates a multi_thread Runtime (probably unnecessary for this case) with all features enabled (which should be reviewed).

@ElFantasma
Copy link
Collaborator

This and the previous PR confuses between tasks::GenServerHandle::start_on_thread() and threads::GenServer::start():

tasks::GenServerHandle::start_on_thread(): Runs async code in its own Runtime in a dedicated thread

threads::GenServer::start(): Runs sync code in a dedicated thread without any async Runtime.

Both exist separately because even when their APIs are similar, the first one has some async functions while the later does not.

unbalancedparentheses and others added 4 commits January 22, 2026 15:10
Add 10 new tests covering:
- Backend enum traits (Default, Copy, Clone, Debug, PartialEq, Eq)
- All three backends handle call/cast correctly
- Backend::Thread isolates blocking work from async runtime
- Multiple backends can run concurrently with independent state
- Backend::default() works in start()
Document each backend option with:
- Comparison table showing execution model, best use cases, and limitations
- Code examples for each backend
- Detailed "When to Use" guide with advantages and avoid-when advice
- Per-variant documentation with specific use cases
@ElFantasma ElFantasma force-pushed the pr/new-5-backend-tests branch from 3e8da1d to c13e31f Compare January 22, 2026 18:10
Copy link
Collaborator

@ElFantasma ElFantasma left a comment

Choose a reason for hiding this comment

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

Will approve and merge this one, it LGTM.

@ElFantasma ElFantasma merged commit fcca9c2 into lambdaclass:main Jan 22, 2026
3 checks passed
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.

2 participants