Skip to content

Commit

Permalink
FET: Set correct number of workers
Browse files Browse the repository at this point in the history
  • Loading branch information
akissa committed Feb 19, 2019
1 parent 8076eda commit 405fbc7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions clamavmirror/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
import time
import fcntl
import hashlib
import optparse

from shutil import move
from Queue import Queue
from threading import Thread
from optparse import OptionParser
from subprocess import PIPE, Popen

import certifi
Expand All @@ -81,6 +81,13 @@
from dns.resolver import query, NXDOMAIN


VERSION_INFO = (0, 0, 4)
__author__ = "Andrew Colin Kissa"
__copyright__ = u"© 2016-2019 Andrew Colin Kissa"
__email__ = "andrew@topdog.za.net"
__version__ = ".".join(map(str, VERSION_INFO))


def get_file_md5(filename):
"""Get a file's MD5"""
if os.path.exists(filename):
Expand Down Expand Up @@ -191,7 +198,7 @@ def download_sig(opts, sig, version=None):
"""Download signature from hostname"""
code = None
downloaded = False
useagent = 'ClamAV/0.100.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)'
useagent = 'ClamAV/0.101.1 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)'
manager = PoolManager(
headers=make_headers(user_agent=useagent),
cert_reqs='CERT_REQUIRED',
Expand Down Expand Up @@ -325,15 +332,15 @@ def work(options):
'safebrowsing': safebrowsingv,
'bytecode': bytecodev}
dqueue = Queue(maxsize=0)
dqueue_workers = 4
dqueue_workers = 3
info("[+] \033[92mStarting workers\033[0m")
for index in range(dqueue_workers):
info("=> Starting diff download worker: %d" % (index + 1))
worker = Thread(target=download_diffs, args=(dqueue,))
worker.setDaemon(True)
worker.start()
mqueue = Queue(maxsize=0)
mqueue_workers = 5
mqueue_workers = 4
for index in range(mqueue_workers):
info("=> Starting signature download worker: %d" % (index + 1))
worker = Thread(target=update_sig, args=(mqueue,))
Expand Down Expand Up @@ -364,7 +371,7 @@ def work(options):

def main():
"""Main entry point"""
parser = optparse.Optionparser() # pylint: disable=no-member
parser = OptionParser()
parser.add_option('-a', '--hostname',
help='ClamAV source server hostname',
dest='hostname',
Expand Down

0 comments on commit 405fbc7

Please sign in to comment.