Skip to content

actix-files docs for read_mode_threshold invert the default and small-file behaviors #3850

@jonasmalacofilho

Description

@jonasmalacofilho

Expected Behavior

Unless I'm missing something, read_mode_threshold enables synchronously sending files smaller than the set threshold:

https://github.com/actix/actix-web/blob/main/actix-files/src/chunked.rs#L80-L84

Current Behavior

However, the docs for actix_files::Files::read_mode_threshold and actix_files::NamedFile::read_mode_threshold state:

When a file is smaller than the threshold (bytes), the reader will switch from synchronous (blocking) file-reads to async reads to avoid blocking the main-thread when processing large files.

Possible Solution

It looks like the corresponding statements in the docs need to be inverted.

Steps to Reproduce (for bugs)

N/A.

Context

Noticed this while cargo vet-ing actix-files 0.6.8. Then checked both 0.6.9 and the main branch.

Your Environment

  • Rust Version (I.e, output of rustc -V): N/A
  • Actix Web Version: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions