Skip to content

Commit

Permalink
Fixed Pickle exception for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky4546 committed Dec 22, 2023
1 parent c2447e0 commit 5cbb88b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import lib.common.exceptions as exceptions

VERSION = '0.9.14.00-RC09'
VERSION = '0.9.14.00-RC10'
CABERNET_URL = 'https://github.com/cabernetwork/cabernet'
CABERNET_ID = 'cabernet'
CABERNET_REPO = 'manifest.json'
Expand Down
3 changes: 3 additions & 0 deletions lib/db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def add(self, _table, _values):
DB.conn[self.db_name][threading.get_ident()].commit()
lastrow = cur.lastrowid
cur.close()
self.logger.trace('DB add() exit {}'.format(threading.get_ident()))
return lastrow
except sqlite3.OperationalError as e:
self.logger.warning('{} Add request ignored, retrying {}, {}'
Expand All @@ -120,6 +121,7 @@ def delete(self, _table, _values):
num_deleted = cur.rowcount
DB.conn[self.db_name][threading.get_ident()].commit()
cur.close()
self.logger.trace('DB delete() exit {}'.format(threading.get_ident()))
return num_deleted
except sqlite3.OperationalError as e:
self.logger.warning('{} Delete request ignored, retrying {}, {}'
Expand Down Expand Up @@ -147,6 +149,7 @@ def update(self, _table, _values=None):
lastrow = cur.lastrowid
cur.close()
LOCK.release()
self.logger.trace('DB update() exit {}'.format(threading.get_ident()))
return lastrow
except sqlite3.OperationalError as e:
self.logger.notice('{} Update request ignored, retrying {}, {}'
Expand Down
6 changes: 6 additions & 0 deletions lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ def main(script_dir):
plugins = init_plugins(config_obj)
config_obj.defn_json = None
init_versions(plugins)

if opersystem in ['Windows']:
# Need to make sure all http_sessions are None since
# that object cannot pickle
for name, plugin in plugins.plugins.items():
if plugin.plugin_obj.http_session is not None:
plugin.plugin_obj.http_session = None
pickle_it = Pickling(config)
pickle_it.to_pickle(plugins)

Expand Down

0 comments on commit 5cbb88b

Please sign in to comment.