Skip to content

Commit

Permalink
Merge pull request #2 from NZLostboy/master
Browse files Browse the repository at this point in the history
Pull new changes
  • Loading branch information
NZLostboy committed Sep 30, 2020
2 parents b3ff403 + 7de99a2 commit 8fb0042
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/wok/asynctask.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def clean_old_tasks():
Remove from tasks_queue any task that started before 12 hours ago and has
current status equal do finished or failed.
"""
for id, task in tasks_queue.items():
for id, task in tasks_queue.copy().items():
if task.timestamp < (time.time() - 43200):
if (task.status == 'finished') or (task.status == 'failed'):
task.remove()
Expand Down
11 changes: 9 additions & 2 deletions src/wok/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import subprocess
import sys
import traceback
from configparser import SafeConfigParser
from datetime import datetime
from datetime import timedelta
from multiprocessing import Process
Expand All @@ -39,7 +40,6 @@
import cherrypy
import lxml.etree as ET
import psutil
from cherrypy.lib.reprconf import Parser
from wok import config
from wok.config import paths
from wok.config import PluginConfig
Expand Down Expand Up @@ -86,7 +86,14 @@ def load_plugin_conf(name):
if not plugin_conf:
return None

return Parser().dict_from_file(plugin_conf)
config = SafeConfigParser()
config.read(plugin_conf)
config_as_dict = dict()
for section in config.sections():
config_as_dict[section] = {option: config.get(
section, option) for option in config.options(section)}

return config_as_dict
except ValueError as e:
cherrypy.log.error_log.error(
f'Failed to load plugin conf from {plugin_conf}: {e}'
Expand Down

0 comments on commit 8fb0042

Please sign in to comment.