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

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

Build:
Build:
LAST BUILD BRANCH: 2.0.0
DEFAULT BRANCH: master
Ran 10 Mar 2020 08:06PM UTC
Jobs 1
Files 12
Run time 2s
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

pending completion
21

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

Jobs
ID Job ID Ran Files Coverage
2 21.2 (COMPOSER_ARGS="--no-interaction" COVERAGE_DEPS="php-coveralls/php-coveralls" DEPS=locked CS_CHECK=true TEST_COVERAGE=true) 10 Mar 2020 08:06PM UTC 0
97.92
Travis Job 21.2
Source Files on build 21
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #21
  • 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