Remove lastModified field in config which literally nothing uses anywhere, and prevent some unnecessary writes.

This commit is contained in:
Adam Ierymenko 2017-04-28 19:58:21 -07:00
parent d69bc4fb5e
commit a9ce773584
2 changed files with 8 additions and 17 deletions

View File

@ -715,20 +715,18 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
member["address"] = addrs; // legacy
member["nwid"] = nwids;
_removeMemberNonPersistedFields(member);
if (member != origMember) {
member["lastModified"] = now;
json &revj = member["revision"];
member["revision"] = (revj.is_number() ? ((uint64_t)revj + 1ULL) : 1ULL);
_removeMemberNonPersistedFields(member);
_db.saveNetworkMember(nwid,address,member);
_pushMemberUpdate(now,nwid,member);
}
// Add non-persisted fields
member["clock"] = now;
_addMemberNonPersistedFields(member,now);
responseBody = OSUtils::jsonDump(member);
responseContentType = "application/json";
return 200;
} else if ((path.size() == 3)&&(path[2] == "test")) {
@ -1018,11 +1016,10 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
network["id"] = nwids;
network["nwid"] = nwids; // legacy
_removeNetworkNonPersistedFields(network);
if (network != origNetwork) {
json &revj = network["revision"];
network["revision"] = (revj.is_number() ? ((uint64_t)revj + 1ULL) : 1ULL);
network["lastModified"] = now;
_removeNetworkNonPersistedFields(network);
_db.saveNetwork(nwid,network);
// Send an update to all members of the network
@ -1349,11 +1346,9 @@ void EmbeddedNetworkController::_request(
// If they are not authorized, STOP!
if (!authorizedBy) {
if (origMember != member) {
member["lastModified"] = now;
_removeMemberNonPersistedFields(member);
if (origMember != member)
_db.saveNetworkMember(nwid,identity.address().toInt(),member);
}
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_ACCESS_DENIED);
return;
}
@ -1700,11 +1695,9 @@ void EmbeddedNetworkController::_request(
return;
}
if (member != origMember) {
member["lastModified"] = now;
_removeMemberNonPersistedFields(member);
if (member != origMember)
_db.saveNetworkMember(nwid,identity.address().toInt(),member);
}
_sender->ncSendConfig(nwid,requestPacketId,identity.address(),*(nc.get()),metaData.getUI(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION,0) < 6);
}

View File

@ -95,7 +95,6 @@ async.series([function(nextStep) {
creationTime: parseInt(row.creationTime)||0,
enableBroadcast: !!row.enableBroadcast,
ipAssignmentPools: [],
lastModified: Date.now(),
multicastLimit: row.multicastLimit||32,
name: row.name||'',
private: !!row.private,
@ -177,7 +176,6 @@ async.series([function(nextStep) {
ipAssignments: [],
lastAuthorizedTime: (row.authorized) ? Date.now() : 0,
lastDeauthorizedTime: (row.authorized) ? 0 : Date.now(),
lastModified: Date.now(),
lastRequestMetaData: '',
noAutoAssignIps: false,
nwid: row.networkId,