db_insert() in try-catch-Block causes Database Error Messages

Created on 21 June 2018, over 6 years ago
Updated 8 January 2025, about 2 months ago

Hi all,

we noticed a high amount of error messages in our Database, exactly 50% of all inserts to the table ultimate_cron_log failed.
Our devs pointed to the class UltimateCronDatabaseLogEntry, function save() where there is a db_insert()-Call in a try-catch block which they think is the culprit:

try {
db_insert('ultimate_cron_log')
->fields(array(
[...]
))
->execute();
}
catch (PDOException $e) {
// Row already exists. Let's update it, if we can.

I think this should be changed to query for the entries existance first.

🐛 Bug report
Status

Closed: outdated

Version

2.4

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇰Denmark arnested

    I'm closing this since Drupal 7 is now unsupported and there will be no more development on the Drupal 7 branch of Ultimate Cron either.

    Thank you for taking the time and effort in reporting this issue, even though it never got resolved.

Production build 0.71.5 2024