Skip to content

Commit

Permalink
Fixed a bug that caused the workshop backup server to crash in some c…
Browse files Browse the repository at this point in the history
…ases when steam was not available
  • Loading branch information
GhoulofGSG9 committed Aug 10, 2015
1 parent e98a23e commit c7318c9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions workshopbackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def now_millis():

def handle_error(msg):
error_type, error_msg, traceback = sys.exc_info()
log("Caught '%s(%s)' %s" % (error_type, error_msg, msg))
log("Caught '%s' %s" % (error_type, msg))
sys.excepthook(error_type, error_msg, traceback)


Expand Down Expand Up @@ -351,17 +351,17 @@ def post_flush(self):
for mod in mods:
self.mod_database.info_completed(mod)
self.requests.discard(mod.id)

with self.condition:
self.incomingRequests.extend(self.requests)

except urllib.error.URLError as e:
print(e.reason)
except:
handle_error(' when downloading details for %s' % self.requests)

with self.condition:
self.incomingRequests.extend(self.requests)
log('error when downloading details for %s' % self.requests)

self.requests.clear()


class ModDatabase(ProducerThread):
# as we keep a record of both known good mods to backup and requests for mods we don't backup, we need to ensure
# that we don't have too many invalid entries in the database. This sets the limit.
Expand Down Expand Up @@ -590,7 +590,7 @@ def move_to_old(base, ext):
class Logger(object):
def __init__(self, filename, std):
self.terminal = std
self.log = open(filename, "wt", buffering=1)
self.log = open(filename, "wt", buffering=1, encoding='utf-8')

def write(self, message):
self.terminal.write(message)
Expand Down

0 comments on commit c7318c9

Please sign in to comment.