diff --git a/internal/scheduler/scheduler.go b/internal/scheduler/scheduler.go index 9eae869..98eab64 100644 --- a/internal/scheduler/scheduler.go +++ b/internal/scheduler/scheduler.go @@ -215,9 +215,17 @@ func (s *Scheduler) ScheduleBot(bot *models.Bot) error { } // Create the schedule expression - // Format: "0 */X * * * *" where X is the interval in minutes - // This runs at 0 seconds, every X minutes - schedule := fmt.Sprintf("0 */%d * * * *", bot.PostConfig.IntervalMinutes) + // For intervals > 60 minutes, we need to use hours + var schedule string + if bot.PostConfig.IntervalMinutes >= 60 && bot.PostConfig.IntervalMinutes % 60 == 0 { + // Format: "0 0 */X * * *" where X is the interval in hours + // This runs at 0 seconds, 0 minutes, every X hours + schedule = fmt.Sprintf("0 0 */%d * * *", bot.PostConfig.IntervalMinutes/60) + } else { + // Format: "0 */X * * * *" where X is the interval in minutes + // This runs at 0 seconds, every X minutes + schedule = fmt.Sprintf("0 */%d * * * *", bot.PostConfig.IntervalMinutes) + } // Create a job function that captures the bot's information jobFunc := func() { @@ -483,7 +491,9 @@ func (s *Scheduler) ScheduleBot(bot *models.Bot) error { s.logger.Info("Bot scheduled successfully", zap.Int64("bot_id", bot.ID), zap.String("name", bot.Name), - zap.String("schedule", schedule)) + zap.String("schedule", schedule), + zap.Int("interval_minutes", bot.PostConfig.IntervalMinutes), + zap.Int("interval_hours", bot.PostConfig.IntervalMinutes/60)) return nil } diff --git a/nostr-poster.db-shm b/nostr-poster.db-shm new file mode 100644 index 0000000..1553492 Binary files /dev/null and b/nostr-poster.db-shm differ diff --git a/nostr-poster.db-wal b/nostr-poster.db-wal new file mode 100644 index 0000000..ca41454 Binary files /dev/null and b/nostr-poster.db-wal differ