Skip to content

Commit

Permalink
simplified the fsync_file method by removing the unnecessary file des…
Browse files Browse the repository at this point in the history
…criptor parameter
  • Loading branch information
odygrd committed Sep 29, 2024
1 parent 92faa04 commit 59fec49
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/quill/sinks/FileSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class FileSink : public StreamSink

if (_config.fsync_enabled())
{
fsync_file(_file);
fsync_file();
}

if (!fs::exists(_filename))
Expand Down Expand Up @@ -404,9 +404,8 @@ class FileSink : public StreamSink

/**
* Fsync the file descriptor.
* @param fd File descriptor.
*/
void fsync_file(FILE* fd) noexcept
void fsync_file() noexcept
{
auto const now = std::chrono::steady_clock::now();

Expand All @@ -418,9 +417,9 @@ class FileSink : public StreamSink
_last_fsync_timestamp = now;

#ifdef _WIN32
FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(fd))));
FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(_file))));
#else
::fsync(fileno(fd));
::fsync(fileno(_file));
#endif
}

Expand Down

0 comments on commit 59fec49

Please sign in to comment.