Awight has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/300054

Change subject: Reword docs; stop doing popAtomic(function () {})
......................................................................

Reword docs; stop doing popAtomic(function () {})

Change-Id: I9d9275c6106871835c735777828279f98e106fb4
---
M src/PHPQueue/Interfaces/AtomicReadBuffer.php
M test/PHPQueue/Backend/PDOBaseTest.php
2 files changed, 12 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/php-queue 
refs/changes/54/300054/1

diff --git a/src/PHPQueue/Interfaces/AtomicReadBuffer.php 
b/src/PHPQueue/Interfaces/AtomicReadBuffer.php
index c644fa6..901e193 100644
--- a/src/PHPQueue/Interfaces/AtomicReadBuffer.php
+++ b/src/PHPQueue/Interfaces/AtomicReadBuffer.php
@@ -12,17 +12,19 @@
      *
      * @param callable $callback A processing function with the signature,
      *     void function( $message ) throws Exception
-     *         This function accepts an array $message, the next message to be
-     *     popped from your buffer.  In normal operation, the message is popped
-     *     after the function returns successfully, which gives us the
-     *     guarantee that each message is consumed successfully "at least
-     *     once".  The processor callback can handle a message by diverting to
-     *     a reject sink, of course, a clean return only means that the
-     *     callback has completed some action locally considered correct, not
-     *     that there were no errors in processing.
+     *         This function accepts an array $message, the next message popped
+     *     from your buffer.  In normal operation, the message is popped after
+     *     the function returns successfully, which gives us the guarantee that
+     *     each message is consumed successfully "at least once".  The
+     *     processor callback might either handle a message and consume it,
+     *     reject and divert to a dead-letter queue, or raise an exception. The
+     *     contract is that a clean function return means that the callback has
+     *     completed its purpose and the message can be dropped without further
+     *     processing.
      *         Throwing an exception from callback means that we were unable or
      *     chose not to handle the message at all, and it should be considered
-     *     unconsumed.  In this case it is not popped when popAtomic returns.
+     *     unconsumed.  In this case it is not popped from the queue when
+     *     popAtomic returns.
      *         If there are no messages in the queue, the callback is not run.
      *
      * @return array|null popAtomic returns the currently popped record as a
diff --git a/test/PHPQueue/Backend/PDOBaseTest.php 
b/test/PHPQueue/Backend/PDOBaseTest.php
index 5a420a1..267e952 100644
--- a/test/PHPQueue/Backend/PDOBaseTest.php
+++ b/test/PHPQueue/Backend/PDOBaseTest.php
@@ -139,7 +139,7 @@
         }
 
         // Punchline: data should still be available for the retry pop.
-        $this->assertEquals($data, $this->object->popAtomic(function 
($message) {}));
+        $this->assertEquals($data, $this->object->pop());
     }
 
     /**

-- 
To view, visit https://gerrit.wikimedia.org/r/300054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d9275c6106871835c735777828279f98e106fb4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/php-queue
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to