Skip to content

Lower duplicate-job logs to info; keep unexpected failures as errors - #38

Open
KunBojiMan wants to merge 1 commit into
klaviyo:master-3.x.xfrom
KunBojiMan:fix/loglevel-duplicates
Open

Lower duplicate-job logs to info; keep unexpected failures as errors#38
KunBojiMan wants to merge 1 commit into
klaviyo:master-3.x.xfrom
KunBojiMan:fix/loglevel-duplicates

Conversation

@KunBojiMan

Copy link
Copy Markdown

Summary

Duplicate job scheduling/running is expected in some flows. These were logged as errors and triggered noisy alerts without indicating a real issue. This PR lowers those to info while keeping unexpected failures at error level.

Changes

  • Catch JobAlreadyRunningException and JobAlreadyScheduledException and log at info.
  • Keep other throwables at error to preserve visibility.

Files

  • src/Async/TaskHandler/ExcludedSubscribersSyncScheduledTaskHandler.php
  • src/Async/TaskHandler/ScheduleEventJobsHandler.php
  • src/Async/TaskHandler/ScheduleFullSubscriberSyncTaskHandler.php
  • src/Async/TaskHandler/ScheduleFullHistoricalSyncTaskHandler.php
  • src/Async/TaskHandler/ScheduleFullCustomerSubsSyncTaskHandler.php
  • src/Async/TaskHandler/ScheduleFullCustomerOrderSyncTaskHandler.php
  • src/Async/Service/EventsProcessingOperation.php

Implementation note

use Klaviyo\Integration\Exception\JobAlreadyRunningException;
use Klaviyo\Integration\Exception\JobAlreadyScheduledException;

} catch (JobAlreadyRunningException|JobAlreadyScheduledException $e) {
    $this->logger->info($e->getMessage());
} catch (\Throwable $e) {
    $this->logger->error($e->getMessage());
}

Testing

Low. Behavior unchanged except for log level; genuine failures still surface as errors.

Manual run of the affected scheduled tasks to confirm expected info-level log entries and unchanged error handling.


PS: I've already applied these changes in our own shop, but they will be lost the next time we update the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant