diff --git a/funcs/logger.gd b/funcs/logger.gd index f4ff9ab..7b2b665 100644 --- a/funcs/logger.gd +++ b/funcs/logger.gd @@ -363,7 +363,9 @@ class DirSink extends LogSink: _io_thread_current_file.close() func write_bulks(p_log_records: Array[Dictionary], p_formatted_messages: PackedStringArray) -> void: - if _io_thread_log_lock.try_lock(): + # If this causes lag spikes this can be replaced with a try_lock but a second buffer is needed to avoid dropping logs. + # Also if this is ever implemented flush_buffer() would have to use lock and ensure all data is sent to the thread. + if _io_thread_log_lock.lock(): _io_thread_formatted_messages.append_array(p_formatted_messages) _io_thread_log_lock.unlock() _io_thread_work_semaphore.post()