Put garbage collection into the cleaner thread

- this maybe addresses #1079
This commit is contained in:
Peter Šurda 2017-11-22 14:49:18 +01:00
parent e558b1fb72
commit 6ca3460090
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -1,7 +1,7 @@
import gc
import threading import threading
import shared import shared
import time import time
import sys
import os import os
import tr#anslate import tr#anslate
@ -14,7 +14,6 @@ from network.dandelion import Dandelion
from debug import logger from debug import logger
import knownnodes import knownnodes
import queues import queues
import protocol
import state import state
""" """
@ -46,6 +45,7 @@ class singleCleaner(threading.Thread, StoppableThread):
self.initStop() self.initStop()
def run(self): def run(self):
gc.disable()
timeWeLastClearedInventoryAndPubkeysTables = 0 timeWeLastClearedInventoryAndPubkeysTables = 0
try: try:
shared.maximumLengthOfTimeToBotherResendingMessages = (float(BMConfigParser().get('bitmessagesettings', 'stopresendingafterxdays')) * 24 * 60 * 60) + (float(BMConfigParser().get('bitmessagesettings', 'stopresendingafterxmonths')) * (60 * 60 * 24 *365)/12) shared.maximumLengthOfTimeToBotherResendingMessages = (float(BMConfigParser().get('bitmessagesettings', 'stopresendingafterxdays')) * 24 * 60 * 60) + (float(BMConfigParser().get('bitmessagesettings', 'stopresendingafterxmonths')) * (60 * 60 * 24 *365)/12)
@ -148,6 +148,8 @@ class singleCleaner(threading.Thread, StoppableThread):
pass pass
# TODO: cleanup pending upload / download # TODO: cleanup pending upload / download
gc.collect()
if state.shutdown == 0: if state.shutdown == 0:
self.stop.wait(singleCleaner.cycleLength) self.stop.wait(singleCleaner.cycleLength)