mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
cdfba8f7b1
When an application updates metrics for a toggle we now stores the timestamp on the toggle when it was last seen used by an application. This will make it much easier to detect toggles not in use anymore. closes #642
36 lines
758 B
JavaScript
36 lines
758 B
JavaScript
'use strict';
|
|
|
|
module.exports = class Projection {
|
|
constructor() {
|
|
this.store = {};
|
|
}
|
|
|
|
getProjection() {
|
|
return this.store;
|
|
}
|
|
|
|
add(name, countObj) {
|
|
if (this.store[name]) {
|
|
this.store[name].yes += countObj.yes;
|
|
this.store[name].no += countObj.no;
|
|
} else {
|
|
this.store[name] = {
|
|
yes: countObj.yes,
|
|
no: countObj.no,
|
|
};
|
|
}
|
|
}
|
|
|
|
substract(name, countObj) {
|
|
if (this.store[name]) {
|
|
this.store[name].yes -= countObj.yes;
|
|
this.store[name].no -= countObj.no;
|
|
} else {
|
|
this.store[name] = {
|
|
yes: 0,
|
|
no: 0,
|
|
};
|
|
}
|
|
}
|
|
};
|