Files
ubicloud/prog/page_nexus.rb
Enes Cakir 6944422dff Nap 6 hours while waiting for the semaphore to increase
When we increase the semaphore, we have already scheduled the strand for
now.

If the label is just waiting for the semaphore to increase, there's no
need for short naps.

Most of our wait labels are just waiting for the semaphore to increase,
so I extended their naps to 6 hours.

It will help decrease the load on the respirate on production

[^1]: 28dacb968b/model/semaphore.rb (L10)
2025-03-24 09:10:18 +03:00

30 lines
723 B
Ruby

# frozen_string_literal: true
class Prog::PageNexus < Prog::Base
subject_is :page
def self.assemble(summary, tag_parts, related_resources, severity: "error", extra_data: {})
DB.transaction do
return if Page.from_tag_parts(tag_parts)
pg = Page.create_with_id(summary: summary, details: extra_data.merge({"related_resources" => Array(related_resources)}), tag: Page.generate_tag(tag_parts), severity: severity)
Strand.create(prog: "PageNexus", label: "start") { _1.id = pg.id }
end
end
label def start
page.trigger
hop_wait
end
label def wait
when_resolve_set? do
page.resolve
page.destroy
pop "page is resolved"
end
nap 6 * 60 * 60
end
end