Skip to content

Commit 06b4d88

Browse files
authored
Merge pull request #8 from apacheborys/clean-up-docker-and-fix-pdo-transport
fix transport, fix styles, delete docker files, introduce github actions
2 parents 4262364 + c398463 commit 06b4d88

File tree

10 files changed

+53
-350
lines changed

10 files changed

+53
-350
lines changed

.github/workflows/php.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Install dependencies
21+
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-memcached
22+
23+
- name: Update dependencies
24+
run: composer update
25+
26+
- name: Validate composer.json and composer.lock
27+
run: composer validate --strict
28+
29+
- name: Cache Composer packages
30+
id: composer-cache
31+
uses: actions/cache@v3
32+
with:
33+
path: vendor
34+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-php-
37+
38+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
39+
# Docs: https://getcomposer.org/doc/articles/scripts.md
40+
41+
- name: Run test suite
42+
run: composer test

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
],
1212
"require": {
1313
"php": "^7.4||^8.0",
14-
"apacheborys/re-try-php": "*",
14+
"apacheborys/re-try-php": "^0.15",
1515
"psr/log": "^1.1"
1616
},
1717
"require-dev": {
1818
"ext-mongodb": "*",
1919
"ext-json": "*",
2020
"ext-pdo": "*",
21-
"ext-inotify": "*",
2221
"ext-memcached": "*",
2322
"phpunit/phpunit": "9.5.21",
2423
"vimeo/psalm": "^4.30"

docker-compose.yml

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

docker-image/Dockerfile

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

psalm.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@
2020
<file name="src/BasicTransport/Migration/MongoDbTransportMigration.php" />
2121
</errorLevel>
2222
</PossiblyInvalidArgument>
23+
<UnresolvableInclude>
24+
<errorLevel type="suppress">
25+
<file name="src/Common/WarmUpService.php" />
26+
</errorLevel>
27+
</UnresolvableInclude>
2328
</issueHandlers>
2429
</psalm>

src/BasicExecutor/CommandExecutor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function getCorrelationId(Throwable $exception, Config $config): string
123123
$id = $config->getTransport()->getNextId($exception, $config);
124124
}
125125

126-
return (string) $id;
126+
return $id;
127127
}
128128

129129
private function compileArguments(Message $message): string

src/BasicTransport/DbPdoTransport.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class DbPdoTransport implements Transport
3535
self::COLUMN_IS_PROCESSED,
3636
self::COLUMN_SHOULD_BE_EXECUTED_AT,
3737
self::COLUMN_EXECUTOR,
38+
self::COLUMN_CREATED_AT,
3839
];
3940

4041
private PDO $pdo;
@@ -74,6 +75,7 @@ public function send(Message $message): bool
7475
$isProcessed = $message->getIsProcessed();
7576
$shouldBeExecutedAt = $message->getShouldBeExecutedAt()->format('c');
7677
$executor = $message->getExecutor();
78+
$createdAt = (new \DateTimeImmutable())->setTimezone(new \DateTimeZone('UTC'))->format('c');
7779

7880
$st = $this->pdo->prepare($sql);
7981
$st->bindParam(self::COLUMN_ID, $id);
@@ -84,6 +86,7 @@ public function send(Message $message): bool
8486
$st->bindParam(self::COLUMN_IS_PROCESSED, $isProcessed, PDO::PARAM_BOOL);
8587
$st->bindParam(self::COLUMN_SHOULD_BE_EXECUTED_AT, $shouldBeExecutedAt);
8688
$st->bindParam(self::COLUMN_EXECUTOR, $executor);
89+
$st->bindParam(self::COLUMN_CREATED_AT, $createdAt);
8790

8891
return $st->execute();
8992
}

0 commit comments

Comments
 (0)