[webkit-changes] [WebKit/WebKit] ecafc6: [webkitflaskpy] Add IPCManager object

Jonathan Bedard noreply at github.com
Tue Mar 7 13:52:47 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ecafc68a10f3675eabed1bf7592ba2e21e1c12fa
      https://github.com/WebKit/WebKit/commit/ecafc68a10f3675eabed1bf7592ba2e21e1c12fa
  Author: Jonathan Bedard <jbedard at apple.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M Tools/Scripts/libraries/webkitflaskpy/setup.py
    M Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py
    A Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/ipc_manager.py
    A Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/tests/ipc_manager_unittest.py

  Log Message:
  -----------
  [webkitflaskpy] Add IPCManager object
https://bugs.webkit.org/show_bug.cgi?id=253124
rdar://106059293

Reviewed by Dewei Zhu.

Implement a generalized version of a Redis queue to pass tasks to worker processes.
These sorts of queues are most often used by web services to handle incoming hooks.

* Tools/Scripts/libraries/webkitflaskpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/__init__.py: Export IPCManager class.
* Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/ipc_manager.py: Added.
(IPCManager.encode): Return encoded dictionary and database key.
(IPCManager.__init__): Construct manager with a list of databases.
(IPCManager.register): Register a callback with a specific name.
(IPCManager.enqueue): Add a task to be run with arguments, number of retries and expiration.
(IPCManager.dequeue): Execute the specified task. If the execution is successful, delete the task.
Otherwise, decrement the retry counter for that task before raising the thrown exception.
(IPCManager.dequeue_all): Execute all tasks currently in the queue.
(IPCManager.tasks): List all tasks in the queue.
* Tools/Scripts/libraries/webkitflaskpy/webkitflaskpy/tests/ipc_manager_unittest.py: Added.
(IPCManagerUnittest.increment):
(IPCManagerUnittest.decrement):
(IPCManagerUnittest.test_encoding):
(IPCManagerUnittest.test_enqueue):
(IPCManagerUnittest.test_dequeue):
(IPCManagerUnittest.test_dequeue_all):
(IPCManagerUnittest.test_retry):

Canonical link: https://commits.webkit.org/261343@main




More information about the webkit-changes mailing list