`\Drupal\pusher_api\Service\PusherService::trigger()` is declared as returning
`void` and wraps the inner Pusher SDK call in
`try { ... } catch (\Throwable $e) { $this->loggerChannel->error(...); }`.
This means a caller has no way to know if the Pusher publish actually succeeded —
Soketi/Pusher being down, an HTTP timeout, invalid credentials, channel limits
exceeded etc. are all swallowed and turn into a silent log entry.
This breaks the contract for any caller that needs to make decisions based on
delivery result. Concrete example: writing a `MessageNotifier` plugin for
`message_notify`, where the contract is:
public function deliver(array $output = []): bool;
Returning `TRUE` is supposed to mean "delivered". With the current API the
notifier can only return `TRUE` optimistically and `MessageNotifierBase::postSend()`'s
`save on fail` configuration becomes useless.
The same situation applies to any code that wants to fall back to a different
transport (queue for retry, fall through to email) on Pusher failure.
### Steps to reproduce
1. Configure `pusher_api` with a host that doesn't respond (or stop Soketi).
2. Call `\Drupal::service(PusherService::class)->trigger(...)`.
only a `dblog` entry.
### Proposed resolution
Change `PusherService::trigger()` to return `bool`:
- `TRUE` on successful publish
- `FALSE` after catching `\Throwable` (still log the error)
Backwards compatibility: callers that currently call `trigger(...)` and ignore
the return value are unaffected. Callers that want to react to failure can now
check the return.
Alternative considered: a separate `triggerOrFail()` method that rethrows.
Useful but extra surface area; just changing the return type is simpler and a
strict superset.
Issue fork pusher_api-3591837
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
immoreel commentedComment #4
fabianderijkComment #5
fabianderijkMR is now merged. Thanks!