Skip to content

Race condition when writing multiple files in the same directory in parallel #256

@linfaxin

Description

@linfaxin

https://codepen.io/linfaxin/pen/myeXZMv

  import { fs } from "@zenfs/core";

  await Promise.all([
    fs.promises.writeFile("/a1.txt", "a1"),
    fs.promises.writeFile("/a2.txt", "a2"),
  ]);

  const files = await fs.promises.readdir("/");      
  console.log('files', files); // console: ["a2.txt"]

want: ["a1.txt", "a2.txt"]
but get: ["a2.txt"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions