1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-16 09:10:35 +03:00

Add comment as to why the file open is done at top level

This commit is contained in:
Athanasius 2021-01-18 16:31:54 +00:00
parent ab281bca5a
commit 5c09ef78f8

View File

@ -43,6 +43,8 @@ if __name__ == '__main__':
if __name__ == "__main__":
journal_dir = config.get('journaldir') or config.default_journal_dir
# This must be at top level to guarantee the file handle doesn't go out
# of scope and get cleaned up, removing the lock with it.
journal_dir_lockfile = open(join(journal_dir, 'edmc-journal-lock.txt'), mode='w+', encoding='utf-8')
def no_other_instance_running() -> bool: # noqa: CCR001