vtlab-generic-functions 1.0.22 → 1.0.23

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.
@@ -43,6 +43,8 @@ const generateTimestampWithRandomLetters = () => {
43
43
  return `${timestamp}${randomLetters}`;
44
44
  };
45
45
 
46
+ let sqsClient;
47
+
46
48
  const putLogEvents = async (logEvents = [], logGroupName, logLevel = 2, logStreamName = null) => {
47
49
  if (logLevel === 0) {
48
50
  return;
@@ -57,13 +59,16 @@ const putLogEvents = async (logEvents = [], logGroupName, logLevel = 2, logStrea
57
59
  }
58
60
 
59
61
  let awsCredentials = await config.get('awsCredentials');
60
- const sqsClient = new SQSClient({
61
- region: awsCredentials.region,
62
- credentials: {
63
- accessKeyId: awsCredentials.accessKeyId,
64
- secretAccessKey: awsCredentials.secretAccessKey
65
- }
66
- });
62
+
63
+ if (!sqsClient) {
64
+ sqsClient = new SQSClient({
65
+ region: awsCredentials.region,
66
+ credentials: {
67
+ accessKeyId: awsCredentials.accessKeyId,
68
+ secretAccessKey: awsCredentials.secretAccessKey
69
+ }
70
+ })
71
+ }
67
72
 
68
73
  if (!Array.isArray(logEvents)) {
69
74
  logEvents = [logEvents];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtlab-generic-functions",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "scripts": {
5
5
  "test": "jest"
6
6
  },