Skip to content

Commit

Permalink
fixed rpki data digest
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Oct 25, 2023
1 parent 1b753a9 commit 5083c6d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"moment": "^2.29.4",
"node-cleanup": "^2.1.2",
"nodemailer": "^6.9.7",
"object-fingerprint": "^1.0.2",
"path": "^0.12.7",
"restify": "github:massimocandela/node-restify",
"rpki-validator": "^2.13.3",
Expand Down
6 changes: 4 additions & 2 deletions src/utils/rpkiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import md5 from "md5";
import axiosEnrich from "./axiosEnrich";
import axios from "axios";
import moment from "moment";
import fingerprint from "object-fingerprint";

export default class RpkiUtils {
constructor(env) {
Expand Down Expand Up @@ -66,7 +67,7 @@ export default class RpkiUtils {
this._loadRpkiValidator();

if (this.params.markDataAsStaleAfterMinutes > 0) {
this._markAsStale();
setInterval(this._markAsStale, 30 * 1000);
setInterval(this._markAsStale, this.params.markDataAsStaleAfterMinutes * 60 * 1000);
}

Expand Down Expand Up @@ -301,7 +302,8 @@ export default class RpkiUtils {

_markAsStale = () => {
if (!!this.params.preCacheROAs) {
const digest = md5(JSON.stringify(this.getMetadata())) + "-" + this.getVRPs().length;
const digest = fingerprint(this.getVRPs());

if (this.oldDigest) {
const stale = this.oldDigest === digest;

Expand Down

0 comments on commit 5083c6d

Please sign in to comment.