@certik/skynet 0.10.12 → 0.10.15

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.15
4
+
5
+ - Update packages
6
+
7
+ ## 0.10.14
8
+
9
+ - Fix Ably message bottleneck wait time
10
+
11
+ ## 0.10.13
12
+
13
+ - Initialize Ably after user request publishing messages
14
+
15
+ - Increase wait time for Ably message sending bottleneck
16
+
17
+ - Update packages
18
+
3
19
  ## 0.10.12
4
20
 
5
21
  - Fixed distributed lock name for `producer` and `api` type apps
package/ably.js CHANGED
@@ -2,12 +2,23 @@ const Ably = require("ably");
2
2
  const Bottleneck = require("bottleneck/es5");
3
3
  const { ensureAndGet } = require("./env");
4
4
 
5
- const ably = new Ably.Realtime(ensureAndGet("ABLY_ROOT_API_KEY"));
6
- ably.connection.on("connected", () => {
7
- console.log("ably connection successful");
8
- });
5
+ let ABLY;
6
+
7
+ async function getAbly() {
8
+ if (!ABLY) {
9
+ ABLY = await new Promise((resolve) => {
10
+ const ably = new Ably.Realtime(ensureAndGet("ABLY_ROOT_API_KEY"));
11
+ ably.connection.on("connected", () => {
12
+ console.log("ably connection successful");
13
+ resolve(ably);
14
+ });
15
+ });
16
+ }
17
+ return ABLY;
18
+ }
9
19
 
10
20
  async function publishMessage(channel, messageName, messageData) {
21
+ const ably = await getAbly();
11
22
  const channelObj = ably.channels.get(channel);
12
23
 
13
24
  const messageDataJson = JSON.stringify(messageData);
@@ -20,7 +31,7 @@ async function publishMessage(channel, messageName, messageData) {
20
31
  }
21
32
 
22
33
  const rateLimitedPublishMessage = new Bottleneck({
23
- minTime: 1000 / 50,
34
+ minTime: 1000 / 40,
24
35
  }).wrap(publishMessage);
25
36
 
26
37
  module.exports = {
package/examples/api CHANGED
File without changes
package/examples/consumer CHANGED
File without changes
package/examples/indexer CHANGED
File without changes
File without changes
package/examples/producer CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.10.12",
3
+ "version": "0.10.15",
4
4
  "description": "Skynet Shared JS library",
5
5
  "main": "index.js",
6
6
  "author": "CertiK Engineering",
@@ -14,24 +14,24 @@
14
14
  "dependencies": {
15
15
  "@slack/web-api": "^6.4.0",
16
16
  "ably": "^1.2.22",
17
- "aws-sdk": "^2.932.0",
17
+ "aws-sdk": "^2.1164.0",
18
18
  "bottleneck": "^2.19.5",
19
- "chalk": "^4.1.1",
20
- "execa": "^5.0.0",
19
+ "chalk": "^4.1.2",
20
+ "execa": "^5.1.1",
21
21
  "express": "^4.18.1",
22
- "kafkajs": "^1.15.0",
22
+ "kafkajs": "^2.1.0",
23
23
  "md5": "^2.3.0",
24
- "meow": "^7.0.1",
25
- "node-fetch": "^2.6.1",
24
+ "meow": "^9.0.0",
25
+ "node-fetch": "^2.6.7",
26
26
  "snowflake-sdk": "^1.6.3",
27
27
  "web3": "^1.3.5",
28
28
  "which": "^2.0.2"
29
29
  },
30
30
  "devDependencies": {
31
- "ava": "^3.13.0",
32
- "eslint": "^7.22.0",
31
+ "ava": "^4.3.0",
32
+ "eslint": "^8.18.0",
33
33
  "eslint-plugin-import": "^2.26.0",
34
- "sinon": "^11.1.2"
34
+ "sinon": "^14.0.0"
35
35
  },
36
36
  "license": "MIT"
37
37
  }