mattermost / mattermost-plugin-google-calendar

Mattermost Google Calendar Plugin
33 stars 31 forks source link

HA compatible #32

Closed hahmadia closed 3 years ago

hahmadia commented 3 years ago

Summary

Make HA Compatible

hahmadia commented 3 years ago

Not sure why the cron job is not posting the message every minute like I expect it too :( Only does the first time but never after that.

mickmister commented 3 years ago

Nice work! From your post:

There was only one cron job running every minute. I tried migrating it to use the above cluster API. Problem is that it works on startup but never works after that.

So when I connect my calendar, it will post the message Test Job123123 but then every minute after it doesn't post the message anymore.

I'm not sure about why the job is only running once. Do you have any ideas about what code is not running in the imported mattermost-plugin-api code?

Instead of running a separate job for each user, I suggest running just one job that will service all users. This will require the plugin to save info about each user in one array in the kv store. Then in the one job, iterate over that array and process each user separately.

mickmister commented 3 years ago

Check out the job implementation here https://github.com/mattermost/mattermost-plugin-mscalendar/blob/e05112bcad3ad6129b9fe2886a4f3a8056120ea2/server/mscalendar/availability.go#L41

hahmadia commented 3 years ago

@mickmister Done! I implemented a simpler version. As for the jobs not running properly, I think it was something locally. After a restart and nuke, the jobs are running as expected.

hahmadia commented 3 years ago

^^ Also added https://github.com/mattermost/mattermost-plugin-google-calendar/issues/28