Skip to content

Commit

Permalink
Merge branch 'master' into release.24.10
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
ar2rsawseen committed Jan 28, 2025
2 parents ead2d1e + 830a9e8 commit 02b8e19
Show file tree
Hide file tree
Showing 7 changed files with 263 additions and 145 deletions.
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
## Version 24.10.xx
## Version 24.10.6

Fixes:
- [push] Using apns-id header as message result in debug mode
- [server-stats] Fix data point calculation in job
- [TopEventsJob] preserver previous state if overwriting fails
- [ui] scroll top on step changes in drawers

Enterprise fixes:
- [drill] Encoding url component before changing history state
- [drill] Fixed drill meta regeneration

- [drill] [license] Update license loader to enable supplying db client
- [users] Format data points displayed in user sidebar
- [cohorts] Unescape drill texts in cohort component

Dependencies:
- Bump fs-extra from 11.2.0 to 11.3.0
- Bump nodemailer from 6.9.16 to 6.10.0

## Version 24.10.5
Enterprise Dependencies:
- Bump nanoid in /plugins/cognito from 2.1.11 to 3.3.8
- Bump shortid in /plugins/cognito from 2.2.16 to 2.2.17

## Version 24.10.5
Fixes:
- [core] Fixed a bug causing events to not being loaded when there's an escaped character in the event name
- [core] Fixed a bug that was causing drill to crash when there's a percentage symbol in the event name
Expand Down
30 changes: 23 additions & 7 deletions api/jobs/topEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class TopEventsJob extends job.Job {
/**
* TopEvents initialize function
*/
init() {
this.getAllApps();
async init() {
return this.getAllApps();
}

/**
Expand Down Expand Up @@ -144,6 +144,7 @@ class TopEventsJob extends job.Job {
}
catch (error) {
log.e("TopEvents Job has a error: ", error);
throw error;
}
}

Expand All @@ -157,7 +158,18 @@ class TopEventsJob extends job.Job {
const encodedData = this.encodeEvents(data);
const timeSecond = this.timeSecond();
const currentPeriood = this.mutatePeriod(period);
await new Promise((res, rej) => common.db.collection(TopEventsJob.COLLECTION_NAME).insert({ app_id: _id, ts: timeSecond, period: currentPeriood, data: encodedData, totalCount: totalCount, prevTotalCount: prevTotalCount, totalSum: totalSum, prevTotalSum: prevTotalSum, totalDuration: totalDuration, prevTotalDuration: prevTotalDuration, prevSessionCount: sessionData.prevSessionCount, totalSessionCount: sessionData.totalSessionCount, prevUsersCount: usersData.prevUsersCount, totalUsersCount: usersData.totalUsersCount }, (error, records) => !error && records ? res(records) : rej(error)));
await new Promise((res, rej) => common.db.collection(TopEventsJob.COLLECTION_NAME).findOneAndReplace(
{
app_id: _id, period: currentPeriood,
},
{
app_id: _id, ts: timeSecond, period: currentPeriood, data: encodedData, totalCount: totalCount, prevTotalCount: prevTotalCount, totalSum: totalSum, prevTotalSum: prevTotalSum, totalDuration: totalDuration, prevTotalDuration: prevTotalDuration, prevSessionCount: sessionData.prevSessionCount, totalSessionCount: sessionData.totalSessionCount, prevUsersCount: usersData.prevUsersCount, totalUsersCount: usersData.totalUsersCount
},
{
upsert: true
},
(error, records) => !error && records ? res(records) : rej(error))
);
}

/**
Expand All @@ -169,7 +181,6 @@ class TopEventsJob extends job.Job {
const getEvents = await new Promise((res, rej) => common.db.collection("events").findOne({ _id: app._id }, (errorEvents, result) => errorEvents ? rej(errorEvents) : res(result)));
if (getEvents && 'list' in getEvents) {
const eventMap = this.eventsFilter(getEvents.list);
await new Promise((res, rej) => common.db.collection(TopEventsJob.COLLECTION_NAME).remove({ app_id: app._id }, (error, result) => error ? rej(error) : res(result)));
if (eventMap && eventMap instanceof Array) {
for (const period of TopEventsJob.PERIODS) {
const data = {};
Expand Down Expand Up @@ -211,9 +222,14 @@ class TopEventsJob extends job.Job {
* @param {Db} db connection
* @param {done} done callback
*/
run(db, done) {
this.init();
done();
async run(db, done) {
try {
await this.init();
done();
}
catch (error) {
done(error);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/push/api/send/platforms/i.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ class APN extends Base {
status = headers[':status'];
// self.log.d('%d: status %d: %j', i, status, self.session.state);
if (status === 200) {
const apnsUniqueId = headers["apns-unique-id"];
const apnsUniqueId = headers["apns-id"] ?? headers["apns-unique-id"];
oks.push({ p: p._id, r: apnsUniqueId });
stream.destroy();
streamDone();
Expand Down
Loading

0 comments on commit 02b8e19

Please sign in to comment.