module

Hwaro::Core::Build::ParallelHelper

Convenience methods for common parallel operations

Instance methods

execute(tasks : Array(Proc(Nil)), parallel : Bool = true, raise_on_error : Bool = true)

Execute multiple independent tasks in parallel.

raise_on_error: true (default) surfaces the first task failure once every task has drained — sequential mode lets a task exception abort the build, and parallel mode used to swallow it behind a warning, so e.g. a failed sitemap/feed generator still exited 0 and CI shipped a site missing those files. Generic exceptions are promoted to a classified HwaroError (mirroring #490 in process_files_parallel): the lifecycle turns unclassified phase exceptions into a silent HookResult::Abort where --json still reports status "ok".

Serve-time callers that must stay resilient across a transient generator failure (the watch/fast-start passes, where a raise would skip cache persistence and the live-reload signal) pass raise_on_error: false to keep the warn-and-continue behavior.

Source
map(items : Array(T), parallel : Bool = true, &block : T -> R) : Array(R) forall T, R

Parallel map with default configuration

Source
process_pages(pages : Array(T), parallel : Bool = true, &block : T, Int32 -> Bool) : Int32 forall T

Process pages in parallel with automatic worker configuration

Source