TraceMachina / TraceMachina/nativelink

Retry logic introduces too much cognitive complexity

Open
#335 2 comments 0 reactions 1 assignee View on GitHub

@aaronmondal is already working on this.

Since Oct 22, 2023.

enhancement
Dominant language
Rust
Stars
1.6k
Forks
244
Avg merge
1d 16h
Merged PRs (30d)
54

Description

Spin off from https://github.com/TraceMachina/turbo-cache/pull/324 and I've noticed this in other parts of the codebase as well. The current way to add retry capabilities is this:

self.retrier
    .retry(
        retry_config,
        unfold(thing, move |thing| async move {
            // Do something.
        }),
    )
    .await

That's three levels of nesting where the // Do something can get fairly complex as it basically contains the entire stream/state handling logic. Surely there is a more readable way to do this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.