Skip to content

serve: double reload on backup files deletion #383

Closed
@dns2utf8

Description

@dns2utf8

The problem arises when working with an editor like Kate which keeps your current edits in a swap file.

When saving the swapped contents to the real file an event occurs and triggers the rebuild of the book.
While the book is building another event occurs because the swap file is deleted.

On my machine this creates a race.
Sometimes the second thread is fast enough to delete the folder before the first finishes working and nothing happens.
But around 50% of the time the deletion happens right after the first build finished. This means the browser will receive a reload command at the same time as the second thread starts deleting the files. In that case the browser gets a 404 and the reload function is dead. A manual reload is required now.

I see a probable solution by triggering the rebuild with some delay on the server.
Delaying the client is also possible but the client would either have to poll the server for the file or delay a fixed amount of time.
What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: A bug, incorrect or unintended behaviorC-papercutCategory: A small usability bugCommand-serveCommand: serveCommand-watchCommand: watchS-DuplicateStatus: Duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions