Skip to content

Commit 2529053

Browse files
committed
Bugfix - wasn't saving runs
This is what happens when DDB condition strings rely on field names.
1 parent ab82175 commit 2529053

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/app/domain/entityStore/entities/GithubLatestWorkflowRunEventEntity.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ export async function putRunEventIfNoKeyExistsOrNewerThanExisting(
4545
event: GithubWorkflowRunEvent
4646
) {
4747
return await store(entityStore).put(event, {
48-
conditionExpression: 'attribute_not_exists(PK) OR #updatedAt < :newUpdatedAt',
49-
expressionAttributeNames: { '#updatedAt': 'updatedAt' },
50-
expressionAttributeValues: { ':newUpdatedAt': event.runEventUpdatedAt }
48+
conditionExpression: 'attribute_not_exists(PK) OR #runEventUpdatedAt < :newRunEventUpdatedAt',
49+
expressionAttributeNames: { '#runEventUpdatedAt': 'runEventUpdatedAt' },
50+
expressionAttributeValues: { ':newRunEventUpdatedAt': event.runEventUpdatedAt }
5151
})
5252
}
5353

src/app/domain/entityStore/entities/GithubWorkflowRunEntity.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ export async function putGithubWorkflowRunfNoKeyExistsOrNewerThanExisting(
6060
event: GithubWorkflowRunEvent
6161
) {
6262
return await store(entityStore).put(event, {
63-
conditionExpression: 'attribute_not_exists(PK) OR #updatedAt < :newUpdatedAt',
64-
expressionAttributeNames: { '#updatedAt': 'updatedAt' },
65-
expressionAttributeValues: { ':newUpdatedAt': event.runEventUpdatedAt }
63+
conditionExpression: 'attribute_not_exists(PK) OR #runEventUpdatedAt < :newRunEventUpdatedAt',
64+
expressionAttributeNames: { '#runEventUpdatedAt': 'runEventUpdatedAt' },
65+
expressionAttributeValues: { ':newRunEventUpdatedAt': event.runEventUpdatedAt }
6666
})
6767
}
6868

test/testSupport/fakes/tableRecordExpectedWrites.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ export function expectedPutGithubWorkflowRun(event: GithubWorkflowRunEvent) {
9999
...event
100100
},
101101
{
102-
ConditionExpression: 'attribute_not_exists(PK) OR #updatedAt < :newUpdatedAt',
102+
ConditionExpression: 'attribute_not_exists(PK) OR #runEventUpdatedAt < :newRunEventUpdatedAt',
103103
ExpressionAttributeNames: {
104-
'#updatedAt': 'updatedAt'
104+
'#runEventUpdatedAt': 'runEventUpdatedAt'
105105
},
106106
ExpressionAttributeValues: {
107-
':newUpdatedAt': event.runEventUpdatedAt
107+
':newRunEventUpdatedAt': event.runEventUpdatedAt
108108
}
109109
}
110110
)
@@ -122,12 +122,12 @@ export function expectedPutLatestGithubWorkflowRunEvent(event: GithubWorkflowRun
122122
...event
123123
},
124124
{
125-
ConditionExpression: 'attribute_not_exists(PK) OR #updatedAt < :newUpdatedAt',
125+
ConditionExpression: 'attribute_not_exists(PK) OR #runEventUpdatedAt < :newRunEventUpdatedAt',
126126
ExpressionAttributeNames: {
127-
'#updatedAt': 'updatedAt'
127+
'#runEventUpdatedAt': 'runEventUpdatedAt'
128128
},
129129
ExpressionAttributeValues: {
130-
':newUpdatedAt': event.runEventUpdatedAt
130+
':newRunEventUpdatedAt': event.runEventUpdatedAt
131131
}
132132
}
133133
)

0 commit comments

Comments
 (0)