Project

General

Profile

Actions

Defect #14251

open

Redmine email reminders sending 4 emails everytime cron runs

Added by Diego Antunes almost 11 years ago. Updated almost 11 years ago.

Status:
New
Priority:
Urgent
Assignee:
-
Category:
Email notifications
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Hi, this is my environment
Environment:
Redmine version 2.3.1.stable
Ruby version 1.9.3 (x86_64-linux)
Rails version 3.2.13
Environment production
Database adapter Mysql2

Centos 6.3 (Final)

My Cron
*/5 * * * * . /var/www/html/redmine/redmine_fetch_imap //works fine
0 7 * * mon,tue,wed,thu,fri . /var/www/html/redmine/redmine_send_reminders > /var/www/html/redmine/reminders.log 2>&1 this one sends 4 emails each time it runs (or runs 4 times?)

Anyone having this issue?

Actions #1

Updated by Diego Antunes almost 11 years ago

Definitely runs only once, but sends out 4 emails each time it runs.

Actions #2

Updated by Christian Buczek almost 11 years ago

same effect on Windows Server and Redmine 1.4.0

D:\redmine\apps\redmine\htdocs>rake redmine:send_reminders days=1 users="3" RAILS_ENV="production" --trace
Please install RDoc 2.4.2+ to generate documentation.
** Invoke redmine:send_reminders (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:send_reminders

-> sends 3x Mails with same value

CanĀ“t see why. Seems all alright in mailer.rb:

 # Sends reminders to issue assignees
  # Available options:
  # * :days     => how many days in the future to remind about (defaults to 7)
  # * :tracker  => id of tracker for filtering issues (defaults to all trackers)
  # * :project  => id or identifier of project to process (defaults to all projects)
  # * :users    => array of user ids who should be reminded
  def self.reminders(options={})
    days = options[:days] || 7
    project = options[:project] ? Project.find(options[:project]) : nil
    tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
    user_ids = options[:users]

    scope = Issue.open.scoped(:conditions => ["#{Issue.table_name}.assigned_to_id IS NOT NULL" +
      " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
      " AND #{Issue.table_name}.due_date = ?", days.day.from_now.to_date]
    )
    scope = scope.scoped(:conditions => {:assigned_to_id => user_ids}) if user_ids.present?
    scope = scope.scoped(:conditions => {:project_id => project.id}) if project
    scope = scope.scoped(:conditions => {:tracker_id => tracker.id}) if tracker

    issues_by_assignee = scope.all(:include => [:status, :assigned_to, :project, :tracker]).group_by(&:assigned_to)
    issues_by_assignee.each do |assignee, issues|
      deliver_reminder(assignee, issues, days) if assignee.is_a?(User) && assignee.active?
    end
  end

btw: SMTP Server is in local network (tried exchange server and hamster )

Actions

Also available in: Atom PDF