Skip to content

Commit c63705d

Browse files
author
Henning
committed
Merge branch 'master' into hotfix/work-on-prioritzed-job-list
2 parents d9af231 + dd422aa commit c63705d

File tree

10 files changed

+69
-24
lines changed

10 files changed

+69
-24
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log
22

3+
## [0.10.14](https://github.com/php-enqueue/enqueue-dev/tree/0.10.14) (2021-10-29)
4+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.10.13...0.10.14)
5+
6+
**Merged pull requests:**
7+
8+
- Fix passed parameters for compatibility with newest version of dbal [\#1203](https://github.com/php-enqueue/enqueue-dev/pull/1203) ([dgafka](https://github.com/dgafka))
9+
- Allow psr/log v2 and v3 [\#1198](https://github.com/php-enqueue/enqueue-dev/pull/1198) ([snapshotpl](https://github.com/snapshotpl))
10+
- Fix partition's choice for the cases when partition number is zero [\#1196](https://github.com/php-enqueue/enqueue-dev/pull/1196) ([rodrigosarmentopicpay](https://github.com/rodrigosarmentopicpay))
11+
- Added getter for offset field in RdKafkaConsumer class [\#1184](https://github.com/php-enqueue/enqueue-dev/pull/1184) ([DigitVE](https://github.com/DigitVE))
12+
313
## [0.10.13](https://github.com/php-enqueue/enqueue-dev/tree/0.10.13) (2021-08-25)
414
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.10.12...0.10.13)
515

pkg/dbal/DbalConsumerHelperTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function redeliverMessages(): void
9090
->set('redelivered', ':redelivered')
9191
->andWhere('redeliver_after < :now')
9292
->andWhere('delivery_id IS NOT NULL')
93-
->setParameter(':now', time(), DbalType::BIGINT)
93+
->setParameter('now', time(), DbalType::BIGINT)
9494
->setParameter('deliveryId', null, DbalType::GUID)
9595
->setParameter('redelivered', true, DbalType::BOOLEAN)
9696
;
@@ -118,7 +118,7 @@ protected function removeExpiredMessages(): void
118118
->andWhere('delivery_id IS NULL')
119119
->andWhere('redelivered = :redelivered')
120120

121-
->setParameter(':now', time(), DbalType::BIGINT)
121+
->setParameter('now', time(), DbalType::BIGINT)
122122
->setParameter('redelivered', false, DbalType::BOOLEAN)
123123
;
124124

pkg/dbal/Tests/Functional/DbalConsumerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ private function getQuerySize(): int
173173
{
174174
return (int) $this->context->getDbalConnection()
175175
->executeQuery('SELECT count(*) FROM '.$this->context->getTableName())
176-
->fetchColumn(0)
176+
->fetchOne()
177177
;
178178
}
179179
}

pkg/enqueue-bundle/Consumption/Extension/DoctrinePingConnectionExtension.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Doctrine\Persistence\ManagerRegistry;
77
use Enqueue\Consumption\Context\MessageReceived;
88
use Enqueue\Consumption\MessageReceivedExtensionInterface;
9+
use ErrorException;
10+
use Throwable;
911

1012
class DoctrinePingConnectionExtension implements MessageReceivedExtensionInterface
1113
{
@@ -27,7 +29,7 @@ public function onMessageReceived(MessageReceived $context): void
2729
continue;
2830
}
2931

30-
if ($connection->ping()) {
32+
if ($this->ping($connection)) {
3133
continue;
3234
}
3335

@@ -43,4 +45,23 @@ public function onMessageReceived(MessageReceived $context): void
4345
);
4446
}
4547
}
48+
49+
private function ping(Connection $connection): bool
50+
{
51+
set_error_handler(static function (int $severity, string $message, string $file, int $line): bool {
52+
throw new ErrorException($message, $severity, $severity, $file, $line);
53+
});
54+
55+
try {
56+
$dummySelectSQL = $connection->getDatabasePlatform()->getDummySelectSQL();
57+
58+
$connection->executeQuery($dummySelectSQL);
59+
60+
return true;
61+
} catch (Throwable $exception) {
62+
return false;
63+
} finally {
64+
restore_error_handler();
65+
}
66+
}
4667
}

pkg/enqueue-bundle/Tests/Unit/Consumption/Extension/DoctrinePingConnectionExtensionTest.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Enqueue\Bundle\Tests\Unit\Consumption\Extension;
44

55
use Doctrine\DBAL\Connection;
6+
use Doctrine\DBAL\Platforms\AbstractPlatform;
67
use Doctrine\Persistence\ManagerRegistry;
78
use Enqueue\Bundle\Consumption\Extension\DoctrinePingConnectionExtension;
89
use Enqueue\Consumption\Context\MessageReceived;
@@ -29,10 +30,17 @@ public function testShouldNotReconnectIfConnectionIsOK()
2930
->method('isConnected')
3031
->willReturn(true)
3132
;
33+
34+
$abstractPlatform = $this->createMock(AbstractPlatform::class);
35+
$abstractPlatform->expects($this->once())
36+
->method('getDummySelectSQL')
37+
->willReturn('dummy')
38+
;
39+
3240
$connection
3341
->expects($this->once())
34-
->method('ping')
35-
->willReturn(true)
42+
->method('getDatabasePlatform')
43+
->willReturn($abstractPlatform)
3644
;
3745
$connection
3846
->expects($this->never())
@@ -68,10 +76,11 @@ public function testShouldDoesReconnectIfConnectionFailed()
6876
->method('isConnected')
6977
->willReturn(true)
7078
;
79+
7180
$connection
7281
->expects($this->once())
73-
->method('ping')
74-
->willReturn(false)
82+
->method('getDatabasePlatform')
83+
->willThrowException(new \Exception())
7584
;
7685
$connection
7786
->expects($this->once())
@@ -118,7 +127,7 @@ public function testShouldSkipIfConnectionWasNotOpened()
118127
;
119128
$connection1
120129
->expects($this->never())
121-
->method('ping')
130+
->method('getDatabasePlatform')
122131
;
123132

124133
// 2nd connection was opened in the past
@@ -128,10 +137,16 @@ public function testShouldSkipIfConnectionWasNotOpened()
128137
->method('isConnected')
129138
->willReturn(true)
130139
;
140+
$abstractPlatform = $this->createMock(AbstractPlatform::class);
141+
$abstractPlatform->expects($this->once())
142+
->method('getDummySelectSQL')
143+
->willReturn('dummy')
144+
;
145+
131146
$connection2
132147
->expects($this->once())
133-
->method('ping')
134-
->willReturn(true)
148+
->method('getDatabasePlatform')
149+
->willReturn($abstractPlatform)
135150
;
136151

137152
$context = $this->createContext();

pkg/enqueue-bundle/composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
"source": "https://github.com/php-enqueue/enqueue-dev",
2121
"docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
2222
},
23+
"repositories": [
24+
{
25+
"type": "git",
26+
"url": "https://github.com/andrewmy/php-rabbitmq-management-api.git"
27+
}
28+
],
2329
"require-dev": {
2430
"phpunit/phpunit": "^9.5",
2531
"enqueue/stomp": "0.10.x-dev",

pkg/job-queue/Tests/Functional/Entity/Job.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Job extends BaseJob
9595
/**
9696
* @var array
9797
*
98-
* @ORM\Column(name="data", type="json_array", nullable=true)
98+
* @ORM\Column(name="data", type="json", nullable=true)
9999
*/
100100
protected $data;
101101

pkg/null/.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
with:
2727
composer-options: "--prefer-source"
2828

29-
- run: vendor/bin/phpunit --exlude-group=functional
29+
- run: vendor/bin/phpunit --exclude-group=functional

pkg/rdkafka/.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ jobs:
2222
php-version: ${{ matrix.php }}
2323
coverage: none
2424

25-
- run: php Tests/fix_composer_json.php
26-
2725
- uses: "ramsey/composer-install@v1"
26+
with: # ext-rdkafka not needed for tests, and a pain to install on CI;
27+
composer-options: "--ignore-platform-req=ext-rdkafka"
28+
29+
- run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php
2830

2931
- run: vendor/bin/phpunit --exclude-group=functional

pkg/rdkafka/Tests/fix_composer_json.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)