Skip to content

Commit fdaf35c

Browse files
MrSerthDome-GER
authored andcommitted
Handle Runner::Error::RunnerInUse during file copy
When the runner is already in use, we do not want to request a new runner or try copying files again. Hence, this improvement is needed to avoid an invalid state or other errors.
1 parent b6de782 commit fdaf35c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/models/runner.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ def self.for(contributor, execution_environment)
4646
def copy_files(files)
4747
reserve!
4848
@strategy.copy_files(files)
49+
release!
50+
rescue Runner::Error::RunnerInUse => e
51+
Rails.logger.debug { "Copying files failed because the runner was already in use: #{e.message}" }
52+
raise e
4953
rescue Runner::Error => e
5054
Sentry.capture_exception(e) unless e.is_a? Runner::Error::RunnerNotFound
5155
request_new_id
5256
save
5357
@strategy.copy_files(files)
54-
ensure
5558
release!
5659
end
5760

0 commit comments

Comments
 (0)