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
1 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import gc
import threading
import shared
import time
import sys
import os
import tr#anslate
@ -14,7 +14,6 @@ from network.dandelion import Dandelion
from debug import logger
import knownnodes
import queues
import protocol
import state
"""
@ -46,6 +45,7 @@ class singleCleaner(threading.Thread, StoppableThread):
self.initStop()
def run(self):
gc.disable()
timeWeLastClearedInventoryAndPubkeysTables = 0
try:
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
# TODO: cleanup pending upload / download
gc.collect()
if state.shutdown == 0:
self.stop.wait(singleCleaner.cycleLength)