Skip to content

Commit a064002

Browse files
authored
chore: log timing for insert() (#1031)
- Follow up to #1024
1 parent 818355b commit a064002

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/util/backend/db-postgres.ts

+2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ export async function findOne(name: string, version: string) {
3636
}
3737

3838
export async function insert(pkg: PkgSize) {
39+
console.time('insert (postgres)');
3940
const reply = await sql`
4041
INSERT INTO "packages" VALUES (${pkg.name}, ${pkg.version}, ${pkg.publishSize}, ${pkg.installSize}, ${pkg.publishFiles}, ${pkg.installFiles});
4142
`;
43+
console.timeEnd('insert (postgres)');
4244
return reply;
4345
}

src/util/backend/db-redis.ts

+2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ export async function findOne(name: string, version: string) {
5151
}
5252

5353
export async function insert(data: PkgSize) {
54+
console.time('insert (redis)');
5455
const { name, version, ...payload } = data;
5556
const value = JSON.stringify(payload);
5657
const reply = await client.hset(name, version, value);
58+
console.timeEnd('insert (redis)');
5759
return reply;
5860
}

0 commit comments

Comments
 (0)