Class: Html2rss::FeedPipeline::RuntimePolicy
- Inherits:
-
Object
- Object
- Html2rss::FeedPipeline::RuntimePolicy
- Defined in:
- lib/html2rss/feed_pipeline/runtime_policy.rb
Overview
Planner for the runtime request policy and budgets of a feed run.
HTTP request slots (pagination, document GETs, strategy fallback) are planned separately from Browserless preload interaction budget so preload cannot steal pagination slots.
Defined Under Namespace
Classes: Resources
Class Method Summary collapse
-
.budget_for(config) ⇒ Html2rss::RequestService::Budget
Builds a Budget with separate request and interaction slot pools.
-
.from_config(config) ⇒ Html2rss::RequestService::Policy
Request policy derived from runtime config.
-
.interaction_budget_for(config) ⇒ Integer
Preload interaction slots derived from browserless preload config.
-
.resources_for(config) ⇒ Resources
Builds policy and budget from one
from_configso FeedPipeline does not dual-own expansion.
Class Method Details
.budget_for(config) ⇒ Html2rss::RequestService::Budget
Builds a Budget with separate request and interaction slot pools.
48 |
# File 'lib/html2rss/feed_pipeline/runtime_policy.rb', line 48 def self.budget_for(config) = resources_for(config).budget |
.from_config(config) ⇒ Html2rss::RequestService::Policy
Returns request policy derived from runtime config.
18 19 20 21 22 23 24 |
# File 'lib/html2rss/feed_pipeline/runtime_policy.rb', line 18 def self.from_config(config) RequestService::Policy.new( max_requests: effective_max_requests_for(config), max_redirects: config.max_redirects, total_timeout_seconds: config.total_timeout_seconds || RequestService::Policy::DEFAULTS[:total_timeout_seconds] ) end |
.interaction_budget_for(config) ⇒ Integer
Returns preload interaction slots derived from browserless preload config.
53 54 55 |
# File 'lib/html2rss/feed_pipeline/runtime_policy.rb', line 53 def self.interaction_budget_for(config) browserless_preload_budget_for(config) end |
.resources_for(config) ⇒ Resources
Builds policy and budget from one from_config so FeedPipeline does not dual-own expansion.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/html2rss/feed_pipeline/runtime_policy.rb', line 31 def self.resources_for(config) policy = from_config(config) Resources.new( policy:, budget: RequestService::Budget.new( max_requests: policy.max_requests, max_interactions: interaction_budget_for(config), total_timeout_seconds: policy.total_timeout_seconds ) ) end |