badmfck-api-server 4.1.43 → 4.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -156,6 +156,7 @@ export declare class ConfigService extends BaseService {
156
156
  private busy;
157
157
  private retake;
158
158
  private watchDebounceTimer;
159
+ private _lastConfigHash;
159
160
  constructor(dir: string);
160
161
  init(): Promise<void>;
161
162
  configurationDelete(name: string): Promise<IError | boolean>;
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.ConfigService = exports.S_CONFIG_UPDATED = exports.REQ_DEPLOYMENT_CONFIG_DELETE = exports.REQ_DEPLOYMENT_CONFIG_ADD = exports.REQ_DEPLOYMENT_CONFIG = void 0;
30
30
  const fs_1 = __importDefault(require("fs"));
31
31
  const path_1 = __importDefault(require("path"));
32
+ const crypto_1 = __importDefault(require("crypto"));
32
33
  const badmfck_signal_1 = __importStar(require("badmfck-signal"));
33
34
  const BaseService_1 = require("../BaseService");
34
35
  const Validator_1 = require("../helper/Validator");
@@ -99,6 +100,7 @@ class ConfigService extends BaseService_1.BaseService {
99
100
  busy = false;
100
101
  retake = false;
101
102
  watchDebounceTimer = null;
103
+ _lastConfigHash = null;
102
104
  constructor(dir) {
103
105
  super("ConfigService");
104
106
  this.dir = dir;
@@ -174,9 +176,15 @@ class ConfigService extends BaseService_1.BaseService {
174
176
  }
175
177
  }
176
178
  if (!isError) {
177
- this.configurations = temp;
178
- exports.S_CONFIG_UPDATED.invoke();
179
- (0, LogService_1.logWarn)("Configurations updated");
179
+ const hash = crypto_1.default.createHash("md5")
180
+ .update(JSON.stringify(Array.from(temp.entries())))
181
+ .digest("hex");
182
+ if (hash !== this._lastConfigHash) {
183
+ this._lastConfigHash = hash;
184
+ this.configurations = temp;
185
+ exports.S_CONFIG_UPDATED.invoke();
186
+ (0, LogService_1.logWarn)("Configurations updated");
187
+ }
180
188
  }
181
189
  }
182
190
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.1.43",
3
+ "version": "4.1.44",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",