Skip to content

Commit 3af7981

Browse files
committed
Try adding consistentRead after subscription
1 parent 348fa72 commit 3af7981

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

api/sockets/authHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const handler = async (event: WebSocketEvent) => {
8484
);
8585
// console.log(`Result: ${JSON.stringify(result)}`);
8686

87-
const conns = await getConnections();
87+
const conns = await getConnections(true);
8888
await wsBroadcast("connections", conns);
8989

9090
return { statusCode: 200 };

lib/getConnections.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const unmarshallOptions = {
1818
const translateConfig = { marshallOptions, unmarshallOptions };
1919
const ddbDocClient = DynamoDBDocumentClient.from(clnt, translateConfig);
2020

21-
export async function getConnections(): Promise<{
21+
export async function getConnections(consistent = false): Promise<{
2222
totalCount: number;
2323
visibleUserIds: string[];
2424
}> {
@@ -36,6 +36,7 @@ export async function getConnections(): Promise<{
3636
// Only fetch what we need
3737
ProjectionExpression: "userId, invisible",
3838
ExclusiveStartKey: lastKey,
39+
ConsistentRead: consistent,
3940
};
4041

4142
const result = await ddbDocClient.send(new QueryCommand(params));

0 commit comments

Comments
 (0)