Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02b7368

Browse filesBrowse files
committed
[Lock][WIP] Try to debug package tests failure
1 parent 4cef875 commit 02b7368
Copy full SHA for 02b7368

File tree

Expand file treeCollapse file tree

3 files changed

+29
-19
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+29
-19
lines changed

‎.github/workflows/package-tests.yml

Copy file name to clipboardExpand all lines: .github/workflows/package-tests.yml
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ jobs:
2121

2222
- name: Find packages
2323
id: find-packages
24-
run: echo "packages=$(php .github/get-modified-packages.php $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin |jq -R -s -c 'split("\n")[:-1]') $(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]'))" >> $GITHUB_OUTPUT
24+
run: |
25+
all_packages=$(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin |jq -R -s -c 'split("\n")[:-1]')
26+
modified_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]')
27+
echo "$all_packages"
28+
echo "modified_files"
29+
echo "packages=$(php .github/get-modified-packages.php $all_packages $modified_files)" >> $GITHUB_OUTPUT
2530
2631
- name: Verify meta files are correct
2732
run: |

‎src/Symfony/Component/Lock/Bridge/DynamoDb/Store/DynamoDbStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Bridge/DynamoDb/Store/DynamoDbStore.php
+22-18Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
use AsyncAws\DynamoDb\DynamoDbClient;
1515
use AsyncAws\DynamoDb\Exception\ConditionalCheckFailedException;
16+
use AsyncAws\DynamoDb\Input\CreateTableInput;
17+
use AsyncAws\DynamoDb\Input\DeleteItemInput;
1618
use AsyncAws\DynamoDb\Input\DescribeTableInput;
19+
use AsyncAws\DynamoDb\Input\GetItemInput;
20+
use AsyncAws\DynamoDb\Input\PutItemInput;
1721
use AsyncAws\DynamoDb\ValueObject\AttributeDefinition;
1822
use AsyncAws\DynamoDb\ValueObject\AttributeValue;
1923
use AsyncAws\DynamoDb\ValueObject\KeySchemaElement;
@@ -135,22 +139,22 @@ public function save(Key $key): void
135139
$key->reduceLifetime($this->initialTtl);
136140

137141
try {
138-
$this->client->putItem([
142+
$this->client->putItem(new PutItemInput([
139143
'TableName' => $this->tableName,
140144
'Item' => [
141-
$this->idAttr => ['S' => $this->getHashedKey($key)],
142-
$this->tokenAttr => ['S' => $this->getUniqueToken($key)],
143-
$this->expirationAttr => ['N' => (string) (\microtime() + $this->initialTtl)],
145+
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
146+
$this->tokenAttr => new AttributeValue(['S' => $this->getUniqueToken($key)]),
147+
$this->expirationAttr => new AttributeValue(['N' => (string) (\microtime() + $this->initialTtl)]),
144148
],
145149
'ConditionExpression' => 'attribute_not_exists(#key) OR #expires_at < :now',
146150
'ExpressionAttributeNames' => [
147151
'#key' => $this->idAttr,
148152
'#expires_at' => $this->expirationAttr,
149153
],
150154
'ExpressionAttributeValues' => [
151-
':now' => ['N' => (string) \microtime()],
155+
':now' => new AttributeValue(['N' => (string) \microtime()]),
152156
],
153-
]);
157+
]));
154158
} catch (ConditionalCheckFailedException) {
155159
// the lock is already acquired. It could be us. Let's try to put off.
156160
$this->putOffExpiration($key, $this->initialTtl);
@@ -163,23 +167,23 @@ public function save(Key $key): void
163167

164168
public function delete(Key $key): void
165169
{
166-
$this->client->deleteItem([
170+
$this->client->deleteItem(new DeleteItemInput([
167171
'TableName' => $this->tableName,
168172
'Key' => [
169173
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
170174
],
171-
]);
175+
]));
172176
}
173177

174178
public function exists(Key $key): bool
175179
{
176-
$existingLock = $this->client->getItem([
180+
$existingLock = $this->client->getItem(new GetItemInput([
177181
'TableName' => $this->tableName,
178182
'ConsistentRead' => true,
179183
'Key' => [
180184
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
181185
],
182-
]);
186+
]));
183187

184188
$item = $existingLock->getItem();
185189

@@ -208,12 +212,12 @@ public function putOffExpiration(Key $key, float $ttl): void
208212
$uniqueToken = $this->getUniqueToken($key);
209213

210214
try {
211-
$this->client->putItem([
215+
$this->client->putItem(new PutItemInput([
212216
'TableName' => $this->tableName,
213217
'Item' => [
214-
$this->idAttr => ['S' => $this->getHashedKey($key)],
215-
$this->tokenAttr => ['S' => $uniqueToken],
216-
$this->expirationAttr => ['N' => (string) (\microtime() + $ttl)],
218+
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
219+
$this->tokenAttr => new AttributeValue(['S' => $uniqueToken]),
220+
$this->expirationAttr => new AttributeValue(['N' => (string) (\microtime() + $ttl)]),
217221
],
218222
'ConditionExpression' => 'attribute_exists(#key) AND (#token = :token OR #expires_at <= :now)',
219223
'ExpressionAttributeNames' => [
@@ -222,10 +226,10 @@ public function putOffExpiration(Key $key, float $ttl): void
222226
'#token' => $this->tokenAttr,
223227
],
224228
'ExpressionAttributeValues' => [
225-
':now' => ['N' => (string) \microtime()],
229+
':now' => new AttributeValue(['N' => (string) \microtime()]),
226230
':token' => $uniqueToken,
227231
],
228-
]);
232+
]));
229233
} catch (ConditionalCheckFailedException) {
230234
// The item doesn't exist or was acquired by someone else
231235
throw new LockConflictedException();
@@ -238,7 +242,7 @@ public function putOffExpiration(Key $key, float $ttl): void
238242

239243
public function createTable(): void
240244
{
241-
$this->client->createTable([
245+
$this->client->createTable(new CreateTableInput([
242246
'TableName' => $this->tableName,
243247
'AttributeDefinitions' => [
244248
new AttributeDefinition(['AttributeName' => $this->idAttr, 'AttributeType' => 'S']),
@@ -252,7 +256,7 @@ public function createTable(): void
252256
'ReadCapacityUnits' => $this->readCapacityUnits,
253257
'WriteCapacityUnits' => $this->writeCapacityUnits,
254258
]),
255-
]);
259+
]));
256260

257261
$this->client->tableExists(new DescribeTableInput(['TableName' => $this->tableName]))->wait();
258262
}

‎src/Symfony/Component/Lock/Bridge/DynamoDb/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Bridge/DynamoDb/composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"psr/log": "^1|^2|^3"
2525
},
2626
"require-dev": {
27+
"symfony/polyfill-uuid": "^1.15",
2728
"symfony/http-client-contracts": "^2.5|^3"
2829
},
2930
"conflict": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.