Skip to content

Commit

Permalink
fix(pipeline): use close and closed?
Browse files Browse the repository at this point in the history
instead of stop
  • Loading branch information
stakach committed Jul 3, 2023
1 parent 3d4ae0b commit 11a91b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tasker
version: 2.1.1
version: 2.1.2
crystal: ">= 0.36.1"

dependencies:
Expand Down
9 changes: 7 additions & 2 deletions src/tasker/pipeline.cr
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,15 @@ class Tasker
end

# shutdown processing
def stop
def close
@in.close
end

# check if the pipline is running
def closed?
@in.closed?
end

protected def process_loop
loop do
return if @in.closed?
Expand All @@ -97,8 +102,8 @@ class Tasker
t2 = Time.monotonic
@time = t2 - t1
@chained.each(&.process(output))
rescue Channel::ClosedError
rescue error
return if @in.closed?
Log.error(exception: error) { "error in pipeline #{@name}" }
end
end
Expand Down

0 comments on commit 11a91b4

Please sign in to comment.