Skip to content

Commit df08560

Browse files
author
Cihad Tekin
committed
[push] Timeout setting isn't working
1 parent e05e27b commit df08560

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

plugins/push/api/api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ plugins.setConfigs(FEATURE_NAME, {
6565
pool_concurrency: 5, // max number of same type connections
6666
pool_pools: 10, // max number of connections in total
6767
default_content_available: false, // sets content-available: 1 by default for ios
68+
message_timeout: 3600000, // timeout for a message not sent yet (for TooLateToSend error)
6869
});
6970

7071
plugins.internalEvents.push('[CLY]_push_sent');

plugins/push/api/jobs/util/connector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class Connector extends DoFinish {
169169
}
170170
}, callback);
171171
}
172-
else if (push._id.getTimestamp().getTime() < Date.now() - 3600000) {
172+
else if (push._id.getTimestamp().getTime() < (Date.now() - this.state.cfg.message_timeout)) {
173173
this.tooLateToSend.addAffected(push._id, 1);
174174
this.do_flush(callback, true);
175175
return;

plugins/push/api/send/sender.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,29 @@ class Sender {
119119
auth: !(plugins.push.proxyunauthorized || false),
120120
};
121121
}
122+
if (plugins.push.message_timeout) {
123+
if (typeof plugins.push.message_timeout === "number") {
124+
cfg.message_timeout = plugins.push.message_timeout;
125+
}
126+
else {
127+
common.log(`push:send`).w('Invalid message timeout configuration: %j', plugins.push.message_timeout);
128+
}
129+
}
122130
}
123131

124132
return cfg;
125133
}
126134

127135
/**
128-
* Watch push collection for pushes to send,
136+
* Watch push collection for pushes to send,
129137
*/
130138
async watch() {
131139
let oid = dbext.oidBlankWithDate(new Date()),
132140
count = await common.db.collection('push').count({_id: {$lte: oid}});
133141
return count > 0;
134142
}
135143
// /**
136-
// * Watch push collection for pushes to send,
144+
// * Watch push collection for pushes to send,
137145
// */
138146
// async watch() {
139147
// let oid = dbext.oidBlankWithDate(new Date());

plugins/push/frontend/public/localization/push.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ push.pool_pushes = Number of notifications in stream batches
394394
push.pool_bytes = Bytes in binary stream batches
395395
push.pool_concurrency = Maximum number of same type connections
396396
push.pool_pools = Maximum number of connections in total
397+
push.message_timeout = Timeout of a message to be send
397398
push.default_content_available = Set content-available to 1 by default for IOS
398399

399400
#Drawer from other views

0 commit comments

Comments
 (0)