Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a30e2963
Commit
a30e2963
authored
Nov 06, 2020
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix log statements
The cleanup_status should be sent to logs using `log_extra_metadata_on_done`
parent
b5e37659
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
...xpiration_policies/cleanup_container_repository_worker.rb
+3
-2
spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
...tion_policies/cleanup_container_repository_worker_spec.rb
+2
-0
No files found.
app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
View file @
a30e2963
...
...
@@ -16,15 +16,16 @@ module ContainerExpirationPolicies
return
unless
throttling_enabled?
return
unless
container_repository
log_extra_metadata_on_done
(
:container_repository_id
,
container_repository
.
id
)
unless
allowed_to_run?
(
container_repository
)
container_repository
.
cleanup_unscheduled!
log_
info
(
container_repository_id:
container_repository
.
id
,
cleanup_status:
:skipped
)
log_
extra_metadata_on_done
(
:cleanup_status
,
:skipped
)
return
end
result
=
ContainerExpirationPolicies
::
CleanupService
.
new
(
container_repository
)
.
execute
log_extra_metadata_on_done
(
:container_repository_id
,
result
.
payload
[
:container_repository_id
])
log_extra_metadata_on_done
(
:cleanup_status
,
result
.
payload
[
:cleanup_status
])
end
...
...
spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
View file @
a30e2963
...
...
@@ -47,6 +47,8 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
it
'skips the repository'
do
expect
(
ContainerExpirationPolicies
::
CleanupService
).
not_to
receive
(
:new
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:container_repository_id
,
repository
.
id
)
expect
(
worker
).
to
receive
(
:log_extra_metadata_on_done
).
with
(
:cleanup_status
,
:skipped
)
expect
{
subject
}.
to
change
{
ContainerRepository
.
waiting_for_cleanup
.
count
}.
from
(
1
).
to
(
0
)
expect
(
repository
.
reload
.
cleanup_unscheduled?
).
to
be_truthy
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment