#1410 frontend: hot-fix pending-jobs route again
Merged 3 years ago by praiskup. Opened 3 years ago by praiskup.
Unknown source fixup-slow-pending-jobs  into  master

@@ -92,7 +92,6 @@

  

      build_record = None

      try:

-         copr_chroot = CoprChrootsLogic.get_by_name_safe(task.build.copr, task.mock_chroot.name)

          build_record = {

              "task_id": task.task_id,

              "build_id": task.build.id,
@@ -117,9 +116,6 @@

              "uses_devel_repo": task.build.copr.devel_mode,

          }

  

-         if copr_chroot.module_toggle_array:

-             array = [{'enable': m} for m in copr_chroot.module_toggle_array]

-             build_record["modules"] = {'toggle': array}

  

          if task.build.is_background:

              build_record['background'] = True
@@ -127,6 +123,11 @@

          if short:

              return build_record

  

+         copr_chroot = CoprChrootsLogic.get_by_name_safe(task.build.copr, task.mock_chroot.name)

+         if copr_chroot.module_toggle_array:

+             array = [{'enable': m} for m in copr_chroot.module_toggle_array]

+             build_record["modules"] = {'toggle': array}

+ 

          build_config = BuildConfigLogic.generate_build_config(task.build.copr, task.mock_chroot.name)

          build_record["repos"] = build_config.get("repos")

          build_record["buildroot_pkgs"] = build_config.get("additional_packages")

The route was made too slow by ddb706f, and we did not notice
until now (when there's 6k pending tasks). This is breaking other stuff
(e.g. VMs are terminated too fast, before they are starving with new
tasks, therefore hot-fixing).

So the trick was moving the code after if short or am I missing some other change?

So the trick was moving the code after if short or am I missing some other change?

Correct.

I applied that in production, and things are getting to normal I would say. So I'll take the time now to document properly the reason in commit message. Sorry, I was a bit in hurry...

rebased onto 5284f68

3 years ago

Commit 5284f68 fixes this pull-request

Pull-Request has been merged by praiskup

3 years ago

Pull-Request has been merged by praiskup

3 years ago