• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

phly / phly-swoole-taskworker / 21 / 2
98%
master: 98%

Build:
Build:
LAST BUILD BRANCH: 2.0.0
DEFAULT BRANCH: master
Ran 10 Mar 2020 08:06PM UTC
Files 12
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Mar 2020 07:57PM UTC coverage: 97.917%. First build
COMPOSER_ARGS="--no-interaction" COVERAGE_DEPS="php-coveralls/php-coveralls" DEPS=locked CS_CHECK=true TEST_COVERAGE=true

push

travis-ci

weierophinney
feat: service-based deferred listeners

In playing some more with Swoole task workers, I discovered that any
listeners you provide MUST be serializable - which poses a problem for
listeners that compose things such as HTTP clients, database adapters,
etc.

This patch:

- Adds a `Psr\Container\ContainerInterface $container` argument to
  `TaskInterface::__invoke()`.
- Modifies `TaskWorker` to compose the PSR-11 container, and pass it to
  tasks as it invokes them.
- Adds `ServiceBasedTask`, which accepts a service name and payload
  arguments to its constructor. When invoked, it will pull the service
  from the container. If the service is a `DeferredServiceListener`, it
  will pull the listener from that instance and use that. It invokes the
  service.
- Adds `DeferredServiceListener`, which creates a ServiceBasedTask with
  the service name passed to its constructor, and defines a
  `getListener()` method for getting the actual listener to use when
  handling the task.
- Adds `DeferredServiceListenerDelegator`, which creates a
  `DeferredServiceListener` using the service name and the result of
  calling the delegator's factory argument.

What this means is that users can assign the
`DeferredServiceListenerDelegator` as a delegator factory on listeners
that should defer execution to the Swoole task workers. This will be
safer than the `DeferredListenerDelegator` in almost every case.

94 of 96 relevant lines covered (97.92%)

1.95 hits per line

Source Files on job 21.2 (COMPOSER_ARGS="--no-interaction" COVERAGE_DEPS="php-coveralls/php-coveralls" DEPS=locked CS_CHECK=true TEST_COVERAGE=true)
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 14
  • Travis Job 21.2
  • 017dc16c on github
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc