Skip to content

Commit

Permalink
chore(release): 6.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bajankristof authored Jun 19, 2024
2 parents 4fedfad + 73598e5 commit a2da2cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
== 6.0.2 2024-06-19

Fixes:
* Fixed a possible race condition that would cause the transcoder to time out even if the transcoder was still running

== 6.0.2 2024-06-18

Fixes:
Expand Down
16 changes: 11 additions & 5 deletions lib/ffmpeg/timeout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ def self.start(duration, message = nil)
end

def pause
@paused = true
@mutex.synchronize { @paused = true }
nil
end

def resume
@paused = false
tick
@mutex.synchronize do
@last_tick = Time.now
@paused = false
nil
end
end

def tick
@last_tick = Time.now
@mutex.synchronize { @last_tick = Time.now }
nil
end

def cancel
Expand All @@ -33,6 +38,7 @@ def cancel
private

def initialize(duration, message = nil)
@mutex = Mutex.new
@duration = duration
@message = message

Expand All @@ -43,7 +49,7 @@ def initialize(duration, message = nil)
end

def loop
sleep 0.1 while @paused || Time.now - @last_tick <= @duration
sleep 0.1 while @mutex.synchronize { @paused || Time.now - @last_tick <= @duration }

@current_thread.raise(::Timeout::Error, @message || self.class.name)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ffmpeg/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module FFMPEG
VERSION = '6.0.2'
VERSION = '6.0.3'
end

0 comments on commit a2da2cc

Please sign in to comment.