Commit graph

24 commits

Author SHA1 Message Date
jgiannelos c97b8e6851 Implement delayed echo notifications
* EchoEvent now supports `extra` params for job delay and deduplication
* When Echo identifies this type of param it creates a
  DelayedEchoNotificationJob that will be executed after `delay` seconds

Change-Id: Ib0c6789dfe42e9703a67835909e5932c0054089f
2020-10-28 12:11:15 +01:00
Thiemo Kreuz 048a9e84c1 Remove duplicate private property from NotificationDeleteJob
Every job class does store it's properties in the $this->prop array
anyway.

Change-Id: Ib1c810ee367a2771e19fac25056c9e7bef22cb01
2019-10-31 18:18:08 +00:00
Thiemo Kreuz 0efef4faf3 Add strict "array" type hints to code expecting arrays
I found candidates for this by looking for parameters names that end
with a plural "s".

Change-Id: I61c706eb4dfbdadceb0129afd724e6ce1eb4f4a8
2019-10-24 15:18:58 +00:00
Stephane Bisson f361425a34 NotificationJob: make sure we retry to load the event from master
EventMapper->fetchById() has retry on master built-in but it doesn't
kick in in a Job because the load balancer is a new instance and doesn't
know about previous writes.

This change makes the job always read from master to make
sure the event is found. It is going to write to master
right after anyway.

Bug: T204894
Change-Id: I9a2873234f1dd5416e6c2bedeb904880d1f79562
2019-04-16 17:06:48 -07:00
jenkins-bot 19cef58454 Merge "NotificationDeleteJob: Remove unused variable $targetMapper" 2019-03-02 03:43:50 +00:00
Roan Kattouw db6c1f076d NotificationDeleteJob: Remove unused variable $targetMapper
Change-Id: Iaf5e3ae53ae55820dca9c7b7d96506154af0f75d
2019-03-01 17:05:10 -08:00
Umherirrender cdae062d47 Improve param docs and add @var to clarify types
Change-Id: I44f872b3a2921e75aab8e22fec57735f17ee1d8b
2019-02-15 21:23:02 +01:00
Umherirrender 81183a6d86 Add method scope visibility
Change-Id: Id4fe59155d6e0fa2ef1ccf4dc46ee1f109265246
2018-11-02 18:47:39 +01:00
Roan Kattouw fe17b49fcd NotificationMapper: Use batching in deleteByUserEventOffset()
Also test it more meaningfully by setting up a mock database and
asserting that the right DELETE queries are issued.

Change-Id: Id39723b92118e98d9c9f0cd7381e9396dce67c17
2018-08-08 14:57:58 -07:00
jenkins-bot 1c6d589b1b Merge "Remove masterPos from the job specification." 2018-06-25 10:48:16 +00:00
Petr Pchelko bf2cc7e687 Remove masterPos from the job specification.
The `DBMasterPos` class is not JSON-serializable, so
we can not transfer the job in the kafka-based queue.
Before, we were waiting for slaves before executing the
job till the point in time when the job was submitted,
now we will just wait for slaves till the point in time
the job was executed. That lets up not to include the
database master position in the event and make it serializable.

Bug: T192945
Change-Id: I7c754bd1e899bad030cc6434be19daf2542e015f
2018-06-18 19:56:15 +03:00
Roan Kattouw 32b82fa1fe NotifUser: Make resetNotificationCount() default to DB_MASTER
We almost always call it with DB_MASTER, and I'm pretty sure that the
one call that uses DB_REPLICA introduces a race condition. I didn't want
to change that quite yet, though, so I left it in for now.

Change-Id: Ia5a59fdda357b799e327b8ed224f3ccb09509a8a
2018-05-30 05:14:38 +00:00
Stephane Bisson 4690c2fb47 Use static newFromID instead of loadFromID
Bug: T192945
Change-Id: Ifd7c40dfef5147581a59d39a6dbe7312a9b82cc6
2018-05-17 22:29:09 +02:00
Stephane Bisson be88fc58c1 Make NotificationJob json-serializable
NotificationJob used to include an instance
of EchoEvent, which is not serializable.

With this change, it only includes the
event Id (int) and retrieve the event
instance in its run() function.

Bug: T192945
Change-Id: I00950ddfa37717c7dfc19efdca9701693622da5d
2018-05-08 15:52:55 -04:00
WMDE-Fisch 713c28e861 Minor PHPdoc fixes
Change-Id: I037df8d0bd13dd7a8201fd1408bb2f642f9786b6
2017-10-13 13:48:05 +02:00
Kunal Mehta 95f83de225 phpcs: Fix "MediaWiki.Commenting.FunctionComment.WrongStyle" issues
Change-Id: Ieb1d52e6fd4e1de54e6f1bbfde849acd54fbe0dc
2017-06-22 14:14:28 +00:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
Stephane Bisson b3c07eedeb Remove etp_user
Target page entries used to exist for each user
that was notified for an event. They were
removed as the notifications were marked as read.

Now they remain so that the association between
pages and events can be used for moderation
regardless of the notifications read status.

This patch removes everything about
echo_target_page.etp_user from sql and php code.

Bug: T143959
Change-Id: Ib57510e6b0e9202a7e035f8ea59955dca8a0b24a
2016-09-09 09:32:28 -04:00
Stephane Bisson bb7a15e8be Get rid of email bundling
Bug: T135446
Change-Id: I95dc3d70c82c19d89b7a32be0c36294350d5c30d
2016-05-17 16:24:16 -04:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
Kunal Mehta e536eab216 Avoid warnings on older queued EchoNotificationDeleteJobs
Old jobs were queued with array( $userId => $userId ), so there will be no
'0' index. Use array_values() since we don't care about the keys.

Change-Id: I1155d310c7fa09c728797d35d63c7cec0383511c
2015-07-02 15:08:14 -07:00
Kunal Mehta 25e32f1b3e Have EchoNotificationDeleteJob process only one user
EchoNotificationDeleteJob now only processes one user at a time. If
given multiple user ids, it will queue individual jobs for each user id
rather than processing many at once.

Bug: T102574
Change-Id: I627f059280d8fab3854d9ca8417f22179478772c
2015-06-17 00:22:42 -07:00
Kunal Mehta da894d8a43 Fix docs on EchoNotificationDeleteJob and set explicit visibility on functions
Change-Id: I7bfa6b9a7c2a78135005d05024d77a3319c7eed0
2015-06-15 17:58:00 -07:00
Kunal Mehta 9d08c96fad Move all PHP code into includes/
Mainly because I was annoyed at m<tab>o<tab>d<tab>u<tab> to reach
modules/.

Change-Id: Ib149cb2e2612ccddd0503f9d0c5d05b554860a00
2015-06-07 18:54:14 -07:00