@joystick.js/node-canary 0.0.0-canary.342 → 0.0.0-canary.344

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,20 +63,20 @@ var queues_default = {
63
63
  }
64
64
  const db = this.db?.collection(`queue_${this.queue.name}`);
65
65
  const indexes = await db?.indexes();
66
- db.createIndex({ status: 1 });
67
- db.createIndex({ status: 1, nextRunAt: 1 });
68
- db.createIndex({ status: 1, environment: 1, nextRunAt: 1, lockedBy: 1 });
66
+ await db.createIndex({ status: 1 });
67
+ await db.createIndex({ status: 1, nextRunAt: 1 });
68
+ await db.createIndex({ status: 1, environment: 1, nextRunAt: 1, lockedBy: 1 });
69
69
  if (this.queue.options?.cleanup?.completedAfterSeconds) {
70
70
  if (indexes?.find((index) => index?.name === "completedAt_1")) {
71
71
  await db.dropIndex({ completedAt: 1 });
72
72
  }
73
- db.createIndex({ completedAt: 1 }, { expireAfterSeconds: this?.queue?.options?.cleanup?.completedAfterSeconds });
73
+ await db.createIndex({ completedAt: 1 }, { expireAfterSeconds: this?.queue?.options?.cleanup?.completedAfterSeconds });
74
74
  }
75
75
  if (this.queue.options?.cleanup?.failedAfterSeconds) {
76
76
  if (indexes?.find((index) => index?.name === "failedAt_1")) {
77
77
  await db.dropIndex({ failedAt: 1 });
78
78
  }
79
- db.createIndex({ failedAt: 1 }, { expireAfterSeconds: this?.queue?.options?.cleanup?.failedAfterSeconds });
79
+ await db.createIndex({ failedAt: 1 }, { expireAfterSeconds: this?.queue?.options?.cleanup?.failedAfterSeconds });
80
80
  }
81
81
  },
82
82
  logAttempt: function(jobId = "") {
@@ -14,11 +14,6 @@ var sessions_default = {
14
14
  return process.databases._sessions?.collection("sessions").findOne({
15
15
  _id: input?.session_id
16
16
  });
17
- },
18
- delete_expired_sessions: async () => {
19
- return process.databases._sessions?.collection("sessions").deleteMany({
20
- createdAt: { $lte: dayjs().subtract(1, "hour").format() }
21
- });
22
17
  }
23
18
  };
24
19
  export {
@@ -27,15 +27,6 @@ var sessions_default = {
27
27
  input?.session_id
28
28
  ]);
29
29
  return session;
30
- },
31
- delete_expired_sessions: async () => {
32
- const date = new Date();
33
- date.setHours(date.getHours() - 1);
34
- return process.databases.postgresql.query(`
35
- DELETE FROM sessions WHERE created_at::timestamp < $1
36
- `, [
37
- date.toISOString()
38
- ]);
39
30
  }
40
31
  };
41
32
  export {
@@ -1,7 +1,6 @@
1
1
  import setCookie from "../../lib/setCookie.js";
2
2
  import runSessionQuery from "../runSessionQuery.js";
3
3
  var session_default = async (req, res, next) => {
4
- await runSessionQuery("delete_expired_sessions");
5
4
  let session_id = req?.cookies?.joystickSession;
6
5
  const existing_session = session_id ? await runSessionQuery("get_session", {
7
6
  session_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/node-canary",
3
- "version": "0.0.0-canary.342",
3
+ "version": "0.0.0-canary.344",
4
4
  "type": "module",
5
5
  "description": "A Node.js framework for building web apps.",
6
6
  "main": "./dist/index.js",