Skip to content

Commit 6a733fb

Browse files
Display uptime in gateway
1 parent ccfc9ff commit 6a733fb

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlitecloud/drivers",
3-
"version": "0.0.53",
3+
"version": "0.0.54",
44
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",

src/gateway/gateway.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ console.debug(`@sqlitecloud/gateway v${packageJson.version}`)
3131
const app = express()
3232
app.use(express.json())
3333
app.use(express.static('public'))
34+
const appStartedOn = new Date()
3435

3536
// server for socket.io and http endpoints
3637
const server = http.createServer(app)
@@ -183,15 +184,16 @@ function getServerInfo() {
183184
data: {
184185
name: '@sqlitecloud/gateway',
185186
version: packageJson.version,
187+
started: appStartedOn.toISOString(),
188+
uptime: `${Math.floor(process.uptime() / 3600)}h:${Math.floor((process.uptime() % 3600) / 60)}m:${Math.floor(process.uptime() % 60)}s`,
186189
bun: {
187190
version: Bun.version,
188191
path: Bun.which('bun'),
189192
main: Bun.main,
190193
uptime: Math.floor(Bun.nanoseconds() / 1e9) // seconds
191194
},
192195
memory,
193-
cpuUsage: process.cpuUsage(),
194-
date: new Date().toISOString()
196+
cpuUsage: process.cpuUsage()
195197
}
196198
}
197199
}

test/benchmark.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ describe('benchmark', () => {
4747
await destroyDatabaseAsync(connection, database)
4848
})
4949

50+
it(
51+
'should run script 090.sql',
52+
async () => {
53+
const { connection, database } = await createDatabaseAsync()
54+
await runScript(connection, database, '090.sql')
55+
await destroyDatabaseAsync(connection, database)
56+
},
57+
EXTRA_LONG_TIMEOUT
58+
)
59+
5060
it(
5161
'should run script 120.sql',
5262
async () => {

0 commit comments

Comments
 (0)