From d9fe604171a054f60a71daee1c2897205a12fb59 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 2 May 2021 00:07:24 +0200 Subject: [PATCH] improve error handling on file switches --- owrx/audio/wav.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/owrx/audio/wav.py b/owrx/audio/wav.py index 4843c25..3af9435 100644 --- a/owrx/audio/wav.py +++ b/owrx/audio/wav.py @@ -83,9 +83,9 @@ class AudioWriter(object): self.wavefile = self.getWaveFile() file.close() - for profile in self.profiles: - tmp_dir = CoreConfig().get_temporary_directory() + tmp_dir = CoreConfig().get_temporary_directory() + for profile in self.profiles: # create hardlinks for the individual profiles filename = "{tmp_dir}/openwebrx-audiochopper-{pid}-{timestamp}.wav".format( tmp_dir=tmp_dir, @@ -95,7 +95,7 @@ class AudioWriter(object): try: os.link(file.getFileName(), filename) except OSError: - logger.warning("Error while linking job files") + logger.exception("Error while linking job files") continue job = QueueJob(profile, self.outputWriter, filename, self.dsp.get_operating_freq()) @@ -105,8 +105,11 @@ class AudioWriter(object): logger.warning("decoding queue overflow; dropping one file") job.unlink() - # our master can be deleted now, the profiles will delete their hardlinked copies after processing - file.unlink() + try: + # our master can be deleted now, the profiles will delete their hardlinked copies after processing + file.unlink() + except OSError: + logger.exception("Error while unlinking job files") self._scheduleNextSwitch()