creecros / Mailmagik

Kanboard Plugin - Send emails to Kanboard and convert to tasks or comments
MIT License
22 stars 3 forks source link

Seperate from general cronjob #20

Closed creecros closed 1 year ago

creecros commented 1 year ago
          @creecros  I recommend not to put the email polling through the general cron job instead to define a seperate cron job. 

Let me explain a problem I encounterd .

The general cron job also used to sent out reminders for tasks that are due , so we could set only daily schdule for it.

But for taks generation through email , should be somthing to be executed at least hourly.

So putting both jobs in same cron will flood up the email inbox if you have enabled the email notifications.

Originally posted by @isvfgs in https://github.com/creecros/Mailmagik/issues/16#issuecomment-1441220662

creecros commented 1 year ago

At a quick glance, I have no idea how to make a separate cronjob run only 1 event, on a different schedule, much less a newely created event that has nothing to do with the daily crontjob event.

alfredbuehler commented 1 year ago

I have an idea. I have created a command, a compatible event, but I don't know hot to submit that event.

creecros commented 1 year ago

i probably do not know, but if you can show me where you are going, i might be able to think about it more.

alfredbuehler commented 1 year ago

We have now our own cron job. You can simply run

./cli mailmagik:fetchmail

from your crontab, beside your usual cronjob command. This new command invokes mail fetching only, but doesn't trigger any overdue notifications. If you want to switch to the new event, you have to recreate any existing automatic actions for mail fetching. Please note, that using the "old" event is still possible.

In case you have too many actions to fix:

UPDATE actions SET event_name = 'mailmagik.fetchmail' WHERE event_name = 'task.cronjob.daily'
AND action_name LIKE '%ConvertEmailTo%'

Of course, fully at your own risk.

creecros commented 1 year ago

wow look at that, good stuff. goes way over my head!

alfredbuehler commented 1 year ago

Yeah, learning about the event system was not easy.

isvfgs commented 1 year ago

Cool.. Thanks for this update

./cli mailmagik:fetchmail this is what I was looking for..

hoping this update will solve the issue. Will test out and will report if I find any issues.

creecros commented 1 year ago

i just tested and it works flawlessly. this is my new crontab file:

0 8 * * * cd /var/www/app && ./cli cronjob >/dev/null 2>&1
* * * * * cd /var/www/app && ./cli mailmagik:fetchmail
isvfgs commented 1 year ago

Does this resolve the previous problem of at least a task in a project required to initate the email fetch ? if so the readme can be updated with the same

creecros commented 1 year ago

it appears so!