Skip to content

Commit eaa700e

Browse files
Merge pull request #63 from ostdotcom/develop
Merging develop to release
2 parents dcebad5 + 66c21bf commit eaa700e

9 files changed

Lines changed: 35 additions & 27 deletions

File tree

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ env:
1717
- OS_CACHING_ENGINE=memcached
1818
- OST_MEMCACHE_SERVERS=127.0.0.1:11211
1919
node_js:
20-
- "8"
20+
- "12"
21+
- "10"
2122
services:
2223
- memcached
2324
before_install:
24-
- sudo apt-get update
25-
- sudo apt-get install nodejs
26-
- sudo apt-get install npm
25+
- sudo apt-get update
26+
- sudo apt-get install nodejs
27+
- sudo apt-get install npm
2728
install:
28-
- npm install
29+
- npm install
2930
before_script:
3031
- mkdir -p dynamodb
3132
- wget https://s3.ap-south-1.amazonaws.com/dynamodb-local-mumbai/dynamodb_local_latest.zip -O ./dynamodb/dynamodb_local_latest.zip
@@ -39,4 +40,4 @@ script:
3940
after_script:
4041
- kill $(ps aux | grep 'DynamoDBLocal.jar' | awk '{print $2}')
4142
- rm -rf dynamodb
42-
- rm -rf dynamodb_instance_2
43+
- rm -rf dynamodb_instance_2

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Storage v1.0.4
2+
- Upgraded node version to 10.x
3+
- Version bump for dependencies.
4+
15
## Storage v1.0.3
26
- Integrated with new Instance Composer.
37
- Migrated to ES6.
@@ -23,4 +27,4 @@
2327
- Auto Scale services to scale read/write capacity of DynamoDB tables.
2428
- Cache layer on top of Shard management services.
2529
- Model layer for token_balances and transaction_logs to support respective queries to DynamoDB.
26-
- Cache layer on top of token_balances.
30+
- Cache layer on top of token_balances.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.3
1+
1.0.4

config/dynamoFactory.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const AWS = require('aws-sdk'),
88
AWSDaxClient = require('amazon-dax-client'),
99
OSTBase = require('@ostdotcom/base'),
1010
coreConstant = require(rootPrefix + '/config/coreConstant'),
11+
logger = require(rootPrefix + '/lib/logger/customConsoleLogger'),
1112
util = require(rootPrefix + '/lib/util');
1213

1314
const InstanceComposer = OSTBase.InstanceComposer;
@@ -74,6 +75,7 @@ DynamoConfigFactory.prototype = {
7475
logger: configStrategies.storage.enableLogging == 1 ? console : '',
7576
retryDelayOptions: {
7677
customBackoff: function(retryCount) {
78+
logger.debug(`DDB Retry customBackoff called for retryCount: ${retryCount}`);
7779
return coreConstant.fixedRetryAfterTime() + retryCount * coreConstant.variableRetryAfterTime();
7880
}
7981
},

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ostdotcom/storage",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "OST storage provides data storage and sharding services.",
55
"main": "index.js",
66
"scripts": {
@@ -17,14 +17,14 @@
1717
"OST Storage",
1818
"DynamoDB"
1919
],
20-
"author": "OST.COM LTD.",
20+
"author": "OST.com Inc.",
2121
"license": "Apache-2.0",
2222
"bugs": {
2323
"url": "https://github.com/ostdotcom/storage/issues"
2424
},
2525
"homepage": "https://github.com/ostdotcom/storage#readme",
2626
"dependencies": {
27-
"@ostdotcom/base": "1.0.0",
27+
"@ostdotcom/base": "^2.0.0",
2828
"aws-sdk": "2.263.1",
2929
"amazon-dax-client": "1.1.3",
3030
"bignumber.js": "4.1.0"

services/dynamodb/Base.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ DDBServiceBase.prototype = {
6464
const oThis = this;
6565

6666
let r = oThis.validateParams();
67-
logger.debug('=======Base.validateParams.result=======');
68-
logger.debug(r);
67+
6968
if (r.isFailure()) return r;
7069

7170
r = await oThis.executeDdbRequest();
72-
logger.debug('=======Base.executeDdbRequest.result=======');
73-
logger.debug(r);
71+
7472
return r;
7573
},
7674

services/dynamodb/BatchGet.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,12 @@ const batchGetPrototype = {
8080
localResponse = await oThis.batchGetItemAfterWait(batchGetParams, waitTime);
8181

8282
if (!localResponse.isSuccess()) {
83-
if (localResponse.internalErrorCode.includes('ResourceNotFoundException')) {
83+
if (
84+
localResponse.internalErrorCode.includes('ResourceNotFoundException') ||
85+
localResponse.internalErrorCode.includes('ProvisionedThroughputExceededException')
86+
) {
8487
logger.error(
85-
'services/dynamodb/BatchGet.js:executeDdbRequest, ResourceNotFoundException : attemptNo: ',
88+
`services/dynamodb/BatchGet.js:executeDdbRequest, ${localResponse.internalErrorCode} : attemptNo: `,
8689
attemptNo
8790
);
8891
localResponse.data['UnprocessedKeys'] = batchGetParams['RequestItems'];
@@ -161,9 +164,6 @@ const batchGetPrototype = {
161164
}
162165
}
163166

164-
logger.debug('=======Base.perform.result=======');
165-
logger.debug(globalResponse);
166-
167167
return globalResponse;
168168
} catch (err) {
169169
logger.error('services/dynamodb/BatchGet.js:executeDdbRequest inside catch ', err);

services/dynamodb/BatchWrite.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@ const batchWritePrototype = {
7474
response = await oThis.batchWriteItemAfterWait(batchWriteParams, waitTime);
7575

7676
if (!response.isSuccess()) {
77-
if (response.internalErrorCode.includes('ResourceNotFoundException')) {
77+
if (
78+
response.internalErrorCode.includes('ResourceNotFoundException') ||
79+
response.internalErrorCode.includes('ProvisionedThroughputExceededException')
80+
) {
7881
logger.error(
79-
'services/dynamodb/BatchWrite.js:executeDdbRequest, ResourceNotFoundException : attemptNo: ',
82+
`services/dynamodb/BatchWrite.js:executeDdbRequest, ${response.internalErrorCode} : attemptNo: `,
8083
attemptNo
8184
);
8285
response.data['UnprocessedItems'] = batchWriteParams['RequestItems'];
@@ -139,8 +142,6 @@ const batchWritePrototype = {
139142
}
140143
}
141144

142-
logger.debug('=======Base.perform.result=======');
143-
logger.debug(response);
144145
return response;
145146
} catch (err) {
146147
logger.error('services/dynamodb/BatchWrite.js:executeDdbRequest inside catch ', err);
@@ -177,6 +178,10 @@ const batchWritePrototype = {
177178
Object.assign(DDBServiceBatchWriteItem.prototype, batchWritePrototype);
178179
DDBServiceBatchWriteItem.prototype.constructor = batchWritePrototype;
179180

180-
InstanceComposer.registerAsShadowableClass(DDBServiceBatchWriteItem, coreConstant.icNameSpace, 'DDBServiceBatchWriteItem');
181+
InstanceComposer.registerAsShadowableClass(
182+
DDBServiceBatchWriteItem,
183+
coreConstant.icNameSpace,
184+
'DDBServiceBatchWriteItem'
185+
);
181186

182187
module.exports = DDBServiceBatchWriteItem;

services/dynamodb/WaitFor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ const waitForPrototype = {
6868
.ic()
6969
.getInstanceFor(coreConstant.icNameSpace, 'libDynamoDBBase')
7070
.queryDdb(oThis.methodName, 'raw', oThis.waitForMethod, oThis.params);
71-
logger.debug('=======Base.perform.result=======');
72-
logger.debug(r);
7371
return r;
7472
} catch (err) {
7573
logger.error('services/dynamodb/Base.js:executeDdbRequest inside catch ', err);

0 commit comments

Comments
 (0)