Skip to content

Commit 89f271e

Browse files
committed
Use INSERT IGNORE to handle conflicts gracefully.
1 parent 2fde953 commit 89f271e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,14 @@ function ($job) use ($existingJobs) {
111111
}
112112
}
113113

114-
$sql = "INSERT INTO wcf1_background_job
115-
(job, time, identifier)
116-
VALUES (?, ?, ?)";
117-
$statement = WCF::getDB()->prepare($sql);
118-
foreach ($jobs as $job) {
119-
$identifier = null;
120-
if ($job instanceof AbstractUniqueBackgroundJob) {
114+
$sql = "INSERT IGNORE INTO wcf1_background_job
115+
(job, time,identifier)
116+
VALUES (?, ?, ?)";
117+
$statement = WCF::getDB()->prepare($sql);
118+
119+
foreach ($jobs as $job) {
120+
$identifier = null;
121+
if ($job instanceof AbstractUniqueBackgroundJob) {
121122
$identifier = $job->identifier();
122123
}
123124

0 commit comments

Comments
 (0)