feat(xo-server-audit): don't save last hash when it doesn't change (#5251)
This commit is contained in:
parent
d622f7a65c
commit
481adf3a1e
@ -318,6 +318,11 @@ class AuditXoPlugin {
|
||||
return
|
||||
}
|
||||
|
||||
const lastRecordId = await this._storage.getLastId()
|
||||
if (lastRecordId === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
const chain = await xo.audit.getLastChain()
|
||||
|
||||
let lastHash, integrityCheckSuccess
|
||||
@ -325,6 +330,10 @@ class AuditXoPlugin {
|
||||
const hashes = chain.hashes
|
||||
lastHash = hashes[hashes.length - 1]
|
||||
|
||||
if (lastHash === lastRecordId) {
|
||||
return
|
||||
}
|
||||
|
||||
// check the integrity of all stored hashes
|
||||
integrityCheckSuccess = await Promise.all(
|
||||
hashes.map((oldest, key) =>
|
||||
|
Loading…
Reference in New Issue
Block a user