Sha256: 27f5a6f0c4f1d61a8f666b139643d8742ae26f8e4131e3ae81edcea801839f30
Contents?: true
Size: 580 Bytes
Versions: 24
Compression:
Stored size: 580 Bytes
Contents
# frozen_string_literal: true module Puppet::Scheduler class SplayJob < Job attr_reader :splay def initialize(run_interval, splay_limit, &block) @splay = calculate_splay(splay_limit) super(run_interval, &block) end def interval_to_next_from(time) if last_run super else (start_time + splay) - time end end def ready?(time) if last_run super else start_time + splay <= time end end private def calculate_splay(limit) rand(limit + 1) end end end
Version data entries
24 entries across 24 versions & 1 rubygems