Skip to content

Commit 6d60902

Browse files
authored
Merge pull request #6869 from Countly/SER-2595-push-timeout-setting-isnt-working
[SER-2595] push timeout setting isnt working
2 parents e05e27b + 1b5276b commit 6d60902

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
## Version 25.03.xx
2+
Fixes:
3+
- [push] Fixed timeout setting
4+
15
## Version 25.03.25
26
Fixes:
37
- [crashes] Fixed resolving audit log recording
48
- [location] Fixed updating none gps coordinate location after gps location was used
5-
-
9+
610
Enterprise Fixes:
711
- [ab-testing] Add script for fixing variant cohort
812
- [groups] Fix user permission update after updating user group permission

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 (in milliseconds)
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)