playov2-js-utilities 0.3.13 → 0.3.14

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.
@@ -14,8 +14,6 @@ const client = new CloudTasksClient();
14
14
  const PROJECT = process.env.GCP_PROJECT;
15
15
  const LOCATION = process.env.GCP_LOCATION;
16
16
 
17
- const MAX_HTTP_TASK_TTL = 1800000 // milliseconds - half an hour
18
-
19
17
  if (!PROJECT || !LOCATION) {
20
18
  console.warn('You need to pass - GCP_PROJECT, GCP_LOCATION in env for message queue to work!');
21
19
  }
@@ -55,8 +53,6 @@ async function createHttpTask(queueId, payload, messageProcessingProperties, tas
55
53
 
56
54
  task.name = getTaskId(project, location, queue, taskId);
57
55
 
58
- task.dispatchDeadline = _getHTTPTaskTTL(ttl); // nano seconds
59
-
60
56
  if (payload.body) {
61
57
  task.httpRequest.body = Buffer.from(payload.body).toString('base64');
62
58
  }
@@ -91,23 +87,6 @@ const getTaskId = (projectId, locationId, queueId, taskId = uuidv4()) => {
91
87
  return `projects/${projectId}/locations/${locationId}/queues/${queueId}/tasks/${taskId}`;
92
88
  };
93
89
 
94
- /**
95
- * Returns ttl for http tasks in nanoseconds
96
- * https://cloud.google.com/tasks/docs/reference/rest/v2beta3/projects.locations.queues.tasks#resource:-task
97
- * @param {Date} ttl
98
- */
99
- const _getHTTPTaskTTL = (ttl) => {
100
-
101
- const currentTimestamp = new Date().getTime()
102
- const providedTTLTimestamp = new Date(ttl).getTime();
103
-
104
- if (providedTTLTimestamp > currentTimestamp) {
105
- return Math.min(providedTTLTimestamp, MAX_HTTP_TASK_TTL) * 1000000
106
- }
107
-
108
- return MAX_HTTP_TASK_TTL * 1000000;
109
- }
110
-
111
90
  module.exports = {
112
91
  createHttpTask,
113
92
  getTaskId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playov2-js-utilities",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Private package for JS utility functions",
5
5
  "main": "index.js",
6
6
  "scripts": {