Skip to content

Commit

Permalink
🛠 fix: Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
tomy0000000 committed Feb 15, 2022
1 parent 6f773b9 commit d87143e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions workflow/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def _job_pid(name):

with open(pidfile, "rb") as fp:
read = fp.read()
print(str(read))
# print(str(read))
pid = int.from_bytes(read, sys.byteorder)
print(pid)
# print(pid)

if _process_exists(pid):
return pid
Expand Down Expand Up @@ -235,7 +235,7 @@ def run_in_background(name, args, **kwargs):
# Call this script
cmd = [sys.executable, "-m", "workflow.background", name]
_log().debug("[%s] passing job to background runner: %r", name, cmd)
retcode = subprocess.call(cmd, env={"PYTHONPATH": ":".join(sys.path)})
retcode = subprocess.call(cmd)

if retcode: # pragma: no cover
_log().error("[%s] background runner failed with %d", name, retcode)
Expand Down
13 changes: 5 additions & 8 deletions workflow/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
from collections import defaultdict
from functools import total_ordering
from itertools import zip_longest

import requests
from urllib import request

from workflow.util import atomic_writer

Expand Down Expand Up @@ -389,11 +388,10 @@ def retrieve_download(dl):
path = os.path.join(tempfile.gettempdir(), dl.filename)
wf().logger.debug("downloading update from " "%r to %r ...", dl.url, path)

r = requests.get(dl.url)
r.raise_for_status()
r = request.urlopen(dl.url)

with atomic_writer(path, "wb") as file_obj:
file_obj.write(r.content)
file_obj.write(r.read())

return path

Expand Down Expand Up @@ -429,9 +427,8 @@ def get_downloads(repo):

def _fetch():
wf().logger.info("retrieving releases for %r ...", repo)
r = requests.get(url)
r.raise_for_status()
return r.content
r = request.urlopen(url)
return r.read()

key = "github-releases-" + repo.replace("/", "-")
js = wf().cached_data(key, _fetch, max_age=60)
Expand Down

0 comments on commit d87143e

Please sign in to comment.