Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-media-repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
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
TeDomum
matrix-media-repo
Commits
b64db671
Commit
b64db671
authored
1 year ago
by
Travis Ralston
Browse files
Options
Downloads
Patches
Plain Diff
Fix deadlock/race conditions in scheduled tasks reload
parent
8cd299a9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks/schedule.go
+11
-3
11 additions, 3 deletions
tasks/schedule.go
with
11 additions
and
3 deletions
tasks/schedule.go
+
11
−
3
View file @
b64db671
...
...
@@ -71,15 +71,23 @@ func scheduleHourly(name RecurringTaskName, workFn RecurringTaskFn) {
recurLock
.
Lock
()
defer
recurLock
.
Unlock
()
if
val
,
ok
:=
recurDoneChs
[
name
];
ok
{
val
<-
true
// close that channel
// Check if closed, and close if needed
select
{
case
<-
val
:
break
// already closed
default
:
val
<-
true
// close that channel
}
}
recurDoneChs
[
name
]
=
ch
go
func
()
{
defer
close
(
ch
)
defer
func
()
{
close
(
ch
)
recurLock
.
Lock
()
defer
recurLock
.
Unlock
()
delete
(
recurDoneChs
,
name
)
if
recurDoneChs
[
name
]
==
ch
{
delete
(
recurDoneChs
,
name
)
}
}()
for
{
...
...
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