Skip to content

Instantly share code, notes, and snippets.

View alfuken's full-sized avatar

Bohdan Schepansky alfuken

View GitHub Profile
@alfuken
alfuken / threaded_open-ended_page_processing.rb
Created March 24, 2023 12:44
Fetching and processing undefined number of pages in a threaded manner
# using https://github.com/taganaka/easy_threadpool_rb
require "easy_threadpool"
Thread.abort_on_exception = true
class ThreadsafeCounter
def initialize
@counter = 0
@mutex = Mutex.new
end