Skip to content

Commit

Permalink
Merge pull request #38 from hhslepicka/find-multiple
Browse files Browse the repository at this point in the history
FIX: Remove multiprocessing from find_multiple due to pickling issues.
  • Loading branch information
hhslepicka committed Feb 4, 2022
2 parents 32c6b1e + d86fa63 commit c3184de
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions botcity/web/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io
import json
import logging
import multiprocessing
import os
import platform
import random
Expand Down Expand Up @@ -405,7 +404,6 @@ def _to_dict(lbs, elems):
print('Warning: Ignoring best=False for now. It will be supported in the future.')

start_time = time.time()
n_cpus = multiprocessing.cpu_count() - 1

while True:
elapsed_time = (time.time() - start_time) * 1000
Expand All @@ -415,8 +413,7 @@ def _to_dict(lbs, elems):
haystack = self.screenshot()
helper = functools.partial(self._find_multiple_helper, haystack, region, matching, grayscale)

with multiprocessing.Pool(processes=n_cpus) as pool:
results = pool.map(helper, paths)
results = [helper(p) for p in paths]

results = [r for r in results]
if None in results:
Expand Down

0 comments on commit c3184de

Please sign in to comment.