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
027f74c2
Commit
027f74c2
authored
Mar 04, 2021
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let redis cache keys expire after Bulk Import is finished
parent
4b37e477
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
26 deletions
+0
-26
app/models/bulk_imports/entity.rb
app/models/bulk_imports/entity.rb
+0
-10
spec/models/bulk_imports/entity_spec.rb
spec/models/bulk_imports/entity_spec.rb
+0
-16
No files found.
app/models/bulk_imports/entity.rb
View file @
027f74c2
...
@@ -66,16 +66,6 @@ class BulkImports::Entity < ApplicationRecord
...
@@ -66,16 +66,6 @@ class BulkImports::Entity < ApplicationRecord
event
:fail_op
do
event
:fail_op
do
transition
any
=>
:failed
transition
any
=>
:failed
end
end
after_transition
any
=>
[
:finished
,
:failed
]
do
|
entity
|
Gitlab
::
Redis
::
Cache
.
with
do
|
redis
|
pattern
=
"bulk_import:
#{
entity
.
bulk_import
.
id
}
:entity:
#{
entity
.
id
}
:*"
redis
.
scan_each
(
match:
pattern
).
each
do
|
key
|
redis
.
del
(
key
)
end
end
end
end
end
def
update_tracker_for
(
relation
:,
has_next_page
:,
next_page:
nil
)
def
update_tracker_for
(
relation
:,
has_next_page
:,
next_page:
nil
)
...
...
spec/models/bulk_imports/entity_spec.rb
View file @
027f74c2
...
@@ -189,20 +189,4 @@ RSpec.describe BulkImports::Entity, type: :model do
...
@@ -189,20 +189,4 @@ RSpec.describe BulkImports::Entity, type: :model do
expect
(
entity
.
next_page_for
(
:relation
)).
to
eq
(
'nextPage'
)
expect
(
entity
.
next_page_for
(
:relation
)).
to
eq
(
'nextPage'
)
end
end
end
end
describe
'caching'
,
:clean_gitlab_redis_cache
do
let
(
:entity
)
{
create
(
:bulk_import_entity
,
:started
)
}
it
'removes entity cache keys'
do
cache_key
=
"bulk_import:
#{
entity
.
bulk_import
.
id
}
:entity:
#{
entity
.
id
}
:relation:1"
Gitlab
::
Redis
::
Cache
.
with
do
|
redis
|
redis
.
set
(
cache_key
,
1
)
expect
(
redis
).
to
receive
(
:del
).
with
(
cache_key
)
end
entity
.
finish!
end
end
end
end
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