metakgp / metakgp-wiki

Dockerized source for the metakgp wiki.
https://wiki.metakgp.org
GNU General Public License v3.0
23 stars 20 forks source link

Add slack extension for recent changes #22

Closed amrav closed 6 years ago

amrav commented 6 years ago

I used git's subtree merge feature to add kulttuuri/slack_mediawiki into our repo in a subdirectory. This lets us keep the code in a single repository under source control, make changes ourselves, and pick changes from upstream if we like them.

The first commit is just the subtree merge under mediawiki/extensions/SlackNotifications.

The second commit adds a new send method to the extension, called exec_curl, which forks a new curl process to post to Slack without blocking the edit request path. This is more expensive/slow than using a proper event loop (the way we were doing with Redis + Python previously), but at our request rate it doesn't matter, and is much simpler.

screen shot 2017-09-12 at 10 27 37 pm
nishnik commented 6 years ago

Thanks @amrav for this. I would run it on my local machine by tonight and see if everything's alright. Meanwhile, we should add the Batman logo.

amrav commented 6 years ago

Thanks, added the logo to the slack webhook settings.

You're welcome to try it on your machine of course, but I don't think it's strictly necessary to be able to review a patch that the reviewer needs to run the code. It can help if you're unsure about whether/how something will work though.

amrav commented 6 years ago

That's correct, no error handling. Errors are logged though, so we can go and look at what went wrong later. If we find that errors frequently happen, we can look into adding a persistent queue, like Redis. Unfortunately php doesn't have built-in async support, and mediawiki doesn't use an event loop either.