@xuda.io/account_module 1.2.2148 → 1.2.2150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +29 -20
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1280,32 +1280,41 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
1280
1280
  let value = 0;
1281
1281
 
1282
1282
  const key = `chat_conversation_count_${doc._id}`;
1283
+ try {
1284
+ value = db_module.get_memcached_doc(key);
1285
+ } catch (e) {
1286
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1287
+ reduce: true,
1288
+ group_level: 1,
1289
+
1290
+ startkey: [doc._id, ''],
1291
+ endkey: [doc._id, 'zzzzzz'],
1292
+ });
1283
1293
 
1284
- const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_counts', {
1285
- reduce: true,
1286
- group_level: 1,
1287
-
1288
- startkey: [doc._id, ''],
1289
- endkey: [doc._id, 'zzzzzz'],
1290
- });
1291
-
1292
- value = counts_ret?.rows?.[0]?.value || 0;
1293
- db_module.set_memcached_doc(key, value);
1294
+ value = counts_ret?.rows?.[0]?.value || 0;
1295
+ db_module.set_memcached_doc(key, value);
1296
+ }
1294
1297
 
1295
- return;
1298
+ return value;
1296
1299
  };
1297
1300
  const chat_conversation_read = async function () {
1298
- // const account_profile_info = await get_active_account_profile_info(uid);
1299
-
1300
- const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1301
- reduce: true,
1302
- group_level: 2,
1301
+ let value = 0;
1303
1302
 
1304
- startkey: [uid, doc._id, ''],
1305
- endkey: [uid, doc._id, 'zzzzzz'],
1306
- });
1303
+ const key = `chat_conversation_count_${doc._id}`;
1304
+ try {
1305
+ value = db_module.get_memcached_doc(key);
1306
+ } catch (e) {
1307
+ const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
1308
+ reduce: true,
1309
+ group_level: 2,
1310
+
1311
+ startkey: [uid, doc._id, ''],
1312
+ endkey: [uid, doc._id, 'zzzzzz'],
1313
+ });
1307
1314
 
1308
- return counts_ret?.rows?.[0]?.value || 0;
1315
+ return counts_ret?.rows?.[0]?.value || 0;
1316
+ }
1317
+ return value;
1309
1318
  };
1310
1319
 
1311
1320
  doc.notifications = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2148",
3
+ "version": "1.2.2150",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {