Skip to content
This repository was archived by the owner on Aug 3, 2022. It is now read-only.

Race condition. #20

@ChangXiaoning

Description

@ChangXiaoning

Hi, I think there is a race condition in your project: Since I want to store all objects in a single file, set the type option to single. Then, I have two non-blocking requests r1 and r2. r1 saves object o1 with id 1 and r2 deletes the object by id 1. json-file-store will prepare different this._cache to asynchronously write into file. Since two file writing are asynchronously executed, the content of the file is non-deterministic. In other words, it is non-deterministic whether is object with id 1 exists in the file. Maybe a better solution is to utilize a queue, which sequentializes multiple requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions