-
Notifications
You must be signed in to change notification settings - Fork 277
Open
Description
Hello, I use post office with wsgi as cron and the mail is sometimes sent twice as following :
My wsgi file :
application = get_wsgi_application()
logger = logging.getLogger(__name__)
# Send queued mails
try:
import uwsgidecorators
from django.core.management import call_command
@uwsgidecorators.timer(10, target='spooler')
def send_queued_mail(num):
'''Send queued mail every 10 seconds'''
call_command('send_queued_mail', processes=1)
@uwsgidecorators.timer(86400, target='spooler')
def cleanup_mail(num):
'''clean mails older than 90 days database every day'''
call_command('cleanup_mail --days=90', processes=1)
except ImportError:
logger.error('uwsgidecorators not found. Cron and timers are disabled')
The mail sending :
mail.send(
owner.user.email,
settings.DEFAULT_FROM_EMAIL,
template=template_owner,
language=translation.get_language(),
context={
'reciever': invitee,
'sender': owner,
'protocol': 'https',
'domain': domain,
'project': collaborative,
},
)
Any idea of how to fix it ?
Thanks !
petrprikryl
Metadata
Metadata
Assignees
Labels
No labels
