Skip to content

Commit

Permalink
Release v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoehaines authored Jun 30, 2021
2 parents efedeb2 + cf519f0 commit 4971ab4
Show file tree
Hide file tree
Showing 10 changed files with 332 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .ci/require-symfony.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if [ "$SYMFONY_VERSION" = "latest" ]; then
composer require "symfony/http-foundation:$(lastversion symfony/http-foundation --pre)" --no-update
composer require "symfony/http-kernel:$(lastversion symfony/http-kernel --pre)" --no-update
composer require "symfony/security-core:$(lastversion symfony/security-core --pre)" --no-update
composer require "symfony/messenger:$(lastversion symfony/messenger --pre)" --no-update
else
# If we're requesting a specific version we can simply install it
composer require "symfony/config:${SYMFONY_VERSION}" --no-update
Expand All @@ -46,4 +47,10 @@ else
composer require "symfony/http-foundation:${SYMFONY_VERSION}" --no-update
composer require "symfony/http-kernel:${SYMFONY_VERSION}" --no-update
composer require "symfony/security-core:${SYMFONY_VERSION}" --no-update

# Symfony Messenger only exists from 4.1.0 onward
case "$SYMFONY_VERSION" in
4.0*) ;;
^[4-5]*) composer require "symfony/messenger:${SYMFONY_VERSION}" --no-update ;;
esac
fi
35 changes: 35 additions & 0 deletions .github/workflows/license-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Audit bugsnag-symfony dependency licenses

on: [push, pull_request]

jobs:
license-audit:
runs-on: ubuntu-latest
strategy:
matrix:
symfony-version: ['^3.4', '^4.4', '^5.0']

steps:
- uses: actions/checkout@v2

- name: install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'

- name: Fetch decisions.yml
run: curl https://raw.githubusercontent.com/bugsnag/license-audit/master/config/decision_files/global.yml -o decisions.yml

- name: Require Symfony
run: ./.ci/require-symfony.sh "${{ matrix.symfony-version }}"

- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest --no-interaction --no-dev

- name: Run License Finder
# for some reason license finder doesn't run without a login shell (-l)
run: >
docker run -v $PWD:/scan licensefinder/license_finder /bin/bash -lc "
cd /scan &&
license_finder --decisions-file decisions.yml --composer-check-require-only=true --enabled-package-managers=composer
"
8 changes: 8 additions & 0 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,32 @@ jobs:
symfony-version: '2.8.*'
- php-version: 7.1
symfony-version: '^3.0'
- php-version: 7.1
symfony-version: '4.0.*'
- php-version: 7.1
symfony-version: '^4.0'
- php-version: 7.2
symfony-version: '2.8.*'
- php-version: 7.2
symfony-version: '^3.0'
- php-version: 7.2
symfony-version: '4.0.*'
- php-version: 7.2
symfony-version: '^4.0'
- php-version: 7.2
symfony-version: '^5.0'
- php-version: 7.3
symfony-version: '^3.0'
- php-version: 7.3
symfony-version: '4.0.*'
- php-version: 7.3
symfony-version: '^4.0'
- php-version: 7.3
symfony-version: '^5.0'
- php-version: 7.4
symfony-version: '^3.0'
- php-version: 7.4
symfony-version: '4.0.*'
- php-version: 7.4
symfony-version: '^4.0'
- php-version: 7.4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/composer.phar
/.idea
.phpunit.result.cache
decisions.yml
2 changes: 1 addition & 1 deletion BugsnagBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class BugsnagBundle extends Bundle
*
* @return string
*/
const VERSION = '1.9.0';
const VERSION = '1.10.0';
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Changelog
=========

## 1.10.0 (2021-06-30)

### Enhancements

* Add support for Symfony Messenger. Exceptions in workers will now automatically be reported to Bugsnag. The queue of events will also be flushed after each successful job
[Mathieu](https://github.com/MatTheCat)
[#89](https://github.com/bugsnag/bugsnag-symfony/pull/89)
[#125](https://github.com/bugsnag/bugsnag-symfony/pull/125)

### Bug Fixes

* Use `hasPreviousSession` instead of `hasSession` when checking for session data
[Oleg Andreyev](https://github.com/oleg-andreyev)
[#124](https://github.com/bugsnag/bugsnag-symfony/pull/124)

* Set the severity of exceptions to "error" instead of "warning"
[#126](https://github.com/bugsnag/bugsnag-symfony/pull/126)

## 1.9.0 (2021-02-10)

### Enhancements
Expand Down
48 changes: 48 additions & 0 deletions EventListener/BugsnagListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
use Symfony\Component\Messenger\Event\WorkerMessageHandledEvent;

class BugsnagListener implements EventSubscriberInterface
{
Expand Down Expand Up @@ -144,6 +146,41 @@ public function onConsoleError(ConsoleErrorEvent $event)
$this->sendNotify($event->getError(), ['command' => $meta]);
}

/**
* Handle a failing message.
*
* @param \Symfony\Component\Messenger\Event\WorkerMessageFailedEvent $event
*
* @return void
*/
public function onWorkerMessageFailed(WorkerMessageFailedEvent $event)
{
$this->sendNotify(
$event->getThrowable(),
['Messenger' => ['willRetry' => $event->willRetry()]]
);

// Normally we flush after a message has been handled, but this event
// doesn't fire for failed messages so we have to flush here instead
$this->client->flush();
}

/**
* Flush any accumulated reports after a message has been handled.
*
* In batch sending mode reports are usually sent on shutdown but workers
* are (generally) long running processes so this doesn't work. Instead we
* flush after each handled message
*
* @param WorkerMessageHandledEvent $event
*
* @return void
*/
public function onWorkerMessageHandled(WorkerMessageHandledEvent $event)
{
$this->client->flush();
}

/**
* @param \Throwable $throwable
* @param array $meta
Expand All @@ -161,6 +198,7 @@ private function sendNotify($throwable, $meta)
$throwable
);
$report->setUnhandled(true);
$report->setSeverity('error');
$report->setSeverityReason([
'type' => 'unhandledExceptionMiddleware',
'attributes' => [
Expand Down Expand Up @@ -227,6 +265,16 @@ public static function getSubscribedEvents()
}
}

if (class_exists(WorkerMessageFailedEvent::class)) {
// This must run after Symfony's "SendFailedMessageForRetryListener"
// as it sets the "willRetry" flag
$listeners[WorkerMessageFailedEvent::class] = ['onWorkerMessageFailed', 64];
}

if (class_exists(WorkerMessageHandledEvent::class)) {
$listeners[WorkerMessageHandledEvent::class] = ['onWorkerMessageHandled', 128];
}

return $listeners;
}
}
2 changes: 1 addition & 1 deletion Request/SymfonyRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function isRequest()
public function getSession()
{
$session = null;
if ($this->request->hasSession()) {
if ($this->request->hasPreviousSession()) {
$session = $this->request->getSession();
}

Expand Down
Loading

0 comments on commit 4971ab4

Please sign in to comment.