Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds-3407034
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
feeds-3407034
Commits
58e47882
Commit
58e47882
authored
2 years ago
by
Youri van Koppen
Browse files
Options
Downloads
Patches
Plain Diff
Added clearQueueTasks() to Feed and FeedImportHandler and call that when calling Feed::unlock().
parent
d4e64a5f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Entity/Feed.php
+14
-4
14 additions, 4 deletions
src/Entity/Feed.php
src/FeedImportHandler.php
+15
-0
15 additions, 0 deletions
src/FeedImportHandler.php
src/FeedInterface.php
+5
-0
5 additions, 0 deletions
src/FeedInterface.php
with
34 additions
and
4 deletions
src/Entity/Feed.php
+
14
−
4
View file @
58e47882
...
...
@@ -303,6 +303,15 @@ class Feed extends ContentEntityBase implements FeedInterface {
->
startBatchExpire
(
$this
);
}
/**
* {@inheritdoc}
*/
public
function
clearQueueTasks
():
void
{
$this
->
entityTypeManager
()
->
getHandler
(
'feeds_feed'
,
'feed_import'
)
->
clearQueueTasks
(
$this
);
}
/**
* {@inheritdoc}
*/
...
...
@@ -330,10 +339,6 @@ class Feed extends ContentEntityBase implements FeedInterface {
// Allow other modules to react upon finishing importing.
$this
->
eventDispatcher
()
->
dispatch
(
new
ImportFinishedEvent
(
$this
),
FeedsEvents
::
IMPORT_FINISHED
);
// Cleanup.
$this
->
clearStates
();
$this
->
setQueuedTime
(
0
);
$this
->
set
(
'imported'
,
$time
);
$interval
=
$this
->
getType
()
->
getImportPeriod
();
...
...
@@ -495,6 +500,11 @@ class Feed extends ContentEntityBase implements FeedInterface {
public
function
unlock
()
{
\Drupal
::
service
(
'lock.persistent'
)
->
release
(
"feeds_feed_
{
$this
->
id
()
}
"
);
Cache
::
invalidateTags
([
'feeds_feed_locked'
]);
// Clean up stuff.
$this
->
clearStates
();
$this
->
setQueuedTime
(
0
);
$this
->
clearQueueTasks
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/FeedImportHandler.php
+
15
−
0
View file @
58e47882
...
...
@@ -82,6 +82,21 @@ class FeedImportHandler extends FeedHandlerBase {
]);
}
/**
* Removes all queue tasks for the given feed.
*
* @param \Drupal\feeds\FeedInterface $feed
* The feed for which to remove queue tasks.
*/
public
function
clearQueueTasks
(
FeedInterface
$feed
):
void
{
if
(
!
$this
->
database
->
schema
()
->
tableExists
(
'queue'
))
{
return
;
}
$this
->
database
->
delete
(
'queue'
)
->
condition
(
'data'
,
'a:3:{i:0;i:'
.
$feed
->
id
()
.
'%'
,
'LIKE'
)
->
execute
();
}
/**
* Returns the timestamp for the current request.
*
...
...
This diff is collapsed.
Click to expand it.
src/FeedInterface.php
+
5
−
0
View file @
58e47882
...
...
@@ -165,6 +165,11 @@ interface FeedInterface extends ContentEntityInterface, EntityChangedInterface,
*/
public
function
startBatchExpire
();
/**
* Removes all queue tasks for the current feed.
*/
public
function
clearQueueTasks
():
void
;
/**
* Dispatches an entity event.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment