"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "api/parts/data/cache.js" between
countly-server-20.04.1.4.tar.gz and countly-server-20.04.1.5.tar.gz

About: countly-server is a mobile & web analytics, push notifications and crash reporting platform. This is the server part that collects and analyzes data while individual client SDKs (mobile, web or desktop) send the data. Community Edition (commercial Enterprise Edition also available).

cache.js  (countly-server-20.04.1.4):cache.js  (countly-server-20.04.1.5)
skipping to change at line 729 skipping to change at line 729
* @return {Promise} resolves to array of [collection, _id of last record] * @return {Promise} resolves to array of [collection, _id of last record]
*/ */
function createCollection(db, name, size = 1e7) { function createCollection(db, name, size = 1e7) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.onOpened(() => { db.onOpened(() => {
if (!db._native) { if (!db._native) {
return setTimeout(() => { return setTimeout(() => {
createCollection(db, name, size).then(resolve, reject); createCollection(db, name, size).then(resolve, reject);
}, 1000); }, 1000);
} }
db._native.createCollection(name, {capped: true, size: size}, (e, co db._native.createCollection(name, {capped: true, size: size}, (e) =>
l) => { {
if (e) { if (e && e.codeName !== "NamespaceExists") {
log.e(`Error while creating capped collection ${name}:`, e); log.e(`Error while creating capped collection ${name}:`, e);
return reject(e); return reject(e);
} }
let col = db.collection(name);
col.find().sort({_id: -1}).limit(1).toArray((err, arr) => { col.find().sort({_id: -1}).limit(1).toArray((err, arr) => {
if (err) { if (err) {
log.e(`Error while looking for last record in ${name}:`, err); log.e(`Error while looking for last record in ${name}:`, err);
return reject(err); return reject(err);
} }
if (arr && arr.length) { if (arr && arr.length) {
log.d('Last change id %s', arr[0]._id); log.d('Last change id %s', arr[0]._id);
resolve([col, arr[0]._id]); resolve([col, arr[0]._id]);
} }
else { else {
 End of changes. 2 change blocks. 
3 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)