#936 Avoid making more than the predetermined number of workers
Closed a year ago by praiskup. Opened a year ago by schlupov.
copr/ schlupov/copr fix_importer_runner  into  master

@@ -36,11 +36,11 @@ 

              # get the data

              r = get(self.get_url)

              # take the first task

-             builds = filter(lambda x: x["build_id"] not in exclude, r.json())

+             builds = list(filter(lambda x: x["build_id"] not in exclude, r.json()))

              if not builds:

                  log.debug("No new tasks to process.")

  

-             return [ImportTask.from_dict(build) for build in builds]

+             return [ImportTask.from_dict(build) for build in builds[:limit]]

          except Exception as e:

              log.exception("Failed acquire new packages for import:" + str(e))

  

Looks good to me. Just a nitpick, I would move the condition one line up, so the p definition and it's appending to pool is not separated.

However, looking into the code again, the self.try_to_obtain_new_tasks is called with limit parameter which IMHO correctly specifies the number of tasks, that can currently be handled. The problem is, that try_to_obtain_new_tasks doesn't use that parameter. Maybe it would be worth it, to use it?

rebased onto b7bac68

a year ago

I changed the method try_to_obtain_new_tasks so it uses argument limit.

I'd prefer distgit: prefix in commit message, but +1

Pull-Request has been closed by praiskup

a year ago
Metadata