improve error handling on file switches
This commit is contained in:
parent
290f67735d
commit
d9fe604171
@ -83,9 +83,9 @@ class AudioWriter(object):
|
|||||||
self.wavefile = self.getWaveFile()
|
self.wavefile = self.getWaveFile()
|
||||||
|
|
||||||
file.close()
|
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
|
# create hardlinks for the individual profiles
|
||||||
filename = "{tmp_dir}/openwebrx-audiochopper-{pid}-{timestamp}.wav".format(
|
filename = "{tmp_dir}/openwebrx-audiochopper-{pid}-{timestamp}.wav".format(
|
||||||
tmp_dir=tmp_dir,
|
tmp_dir=tmp_dir,
|
||||||
@ -95,7 +95,7 @@ class AudioWriter(object):
|
|||||||
try:
|
try:
|
||||||
os.link(file.getFileName(), filename)
|
os.link(file.getFileName(), filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
logger.warning("Error while linking job files")
|
logger.exception("Error while linking job files")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
job = QueueJob(profile, self.outputWriter, filename, self.dsp.get_operating_freq())
|
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")
|
logger.warning("decoding queue overflow; dropping one file")
|
||||||
job.unlink()
|
job.unlink()
|
||||||
|
|
||||||
|
try:
|
||||||
# our master can be deleted now, the profiles will delete their hardlinked copies after processing
|
# our master can be deleted now, the profiles will delete their hardlinked copies after processing
|
||||||
file.unlink()
|
file.unlink()
|
||||||
|
except OSError:
|
||||||
|
logger.exception("Error while unlinking job files")
|
||||||
|
|
||||||
self._scheduleNextSwitch()
|
self._scheduleNextSwitch()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user