Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12944956
D13485.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D13485.diff
View Options
diff --git a/web/alias-server/config.js b/web/alias-server/config.js
--- a/web/alias-server/config.js
+++ b/web/alias-server/config.js
@@ -8,7 +8,11 @@
serverState: 'serverState',
},
startup: {
- serverState: { processedBlockheight: 0, processedConfirmedTxs: 0 },
+ serverState: {
+ processedBlockheight: 0,
+ processedConfirmedTxs: 0,
+ registeredAliasCount: 0,
+ },
},
connectionUrl: 'mongodb://localhost:27017',
},
diff --git a/web/alias-server/dbMethods.js b/web/alias-server/dbMethods.js
--- a/web/alias-server/dbMethods.js
+++ b/web/alias-server/dbMethods.js
@@ -51,7 +51,7 @@
.collection(config.database.collections.validAliases)
.insertMany(newValidAliases);
log(
- `Inserted ${validAliasesAddedToDbSuccess.insertedCount} reserved aliases into ${config.database.collections.validAliases}`,
+ `Inserted ${validAliasesAddedToDbSuccess.insertedCount} aliases into ${config.database.collections.validAliases}`,
);
return true;
} catch (err) {
@@ -61,15 +61,11 @@
}
},
updateServerStateInDb: async function (db, newServerState) {
- const { processedConfirmedTxs, processedBlockheight } = newServerState;
// An empty document will update the first document returned in the collection
// serverState only has one document
const serverStateQuery = {};
const serverStateUpdate = {
- $set: {
- processedConfirmedTxs,
- processedBlockheight,
- },
+ $set: newServerState,
};
// If you are running the server for the first time and there is no
// serverState in the db, create it
diff --git a/web/alias-server/websocket.js b/web/alias-server/websocket.js
--- a/web/alias-server/websocket.js
+++ b/web/alias-server/websocket.js
@@ -182,6 +182,10 @@
// If no new confirmed txs, this is static
let updatedProcessedBlockheight = processedBlockheight;
+ // Update number of registered aliasess
+ const registeredAliasCount =
+ validAliasesInDb.length + newlyValidAliasTxs.length;
+
if (newlyProcessedConfirmedTxsCount > 0) {
// Due to the ordering of newlyProcessedConfirmedTxs[0] will have the highest blockheight
updatedProcessedBlockheight =
@@ -197,6 +201,7 @@
const newServerState = {
processedConfirmedTxs: updatedProcessedConfirmedTxs,
processedBlockheight: updatedProcessedBlockheight,
+ registeredAliasCount,
};
const serverStateUpdatedInDb = await updateServerStateInDb(
db,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 16:29 (17 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5082700
Default Alt Text
D13485.diff (2 KB)
Attached To
D13485: [alias-server] Add registeredAliasCount to server state
Event Timeline
Log In to Comment