Commit b9180f8f authored by gabime's avatar gabime

Fix to a windows issue, where very high rotation rates sometimes fail if antivirus is running.

parent cf6e9461
...@@ -94,10 +94,17 @@ private: ...@@ -94,10 +94,17 @@ private:
} }
} }
if (details::file_helper::file_exists(src) && details::os::rename(src, target) != 0) if (details::file_helper::file_exists(src) && details::os::rename(src, target) != 0)
{
// if failed try again after small delay.
// this is a workaround to a windows issue, where on high rotation rates the rename fails sometimes (because of antivirus?).
details::os::sleep_for_millis(20);
details::os::remove(target);
if (details::os::rename(src, target) != 0)
{ {
throw spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno); throw spdlog_ex("rotating_file_sink: failed renaming " + filename_to_str(src) + " to " + filename_to_str(target), errno);
} }
} }
}
file_helper_.reopen(true); file_helper_.reopen(true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment