Browse Source

use await

utsushiiro 7 years ago
parent
commit
df3bf74550
1 changed files with 3 additions and 5 deletions
  1. 3 5
      src/server/service/config-manager.js

+ 3 - 5
src/server/service/config-manager.js

@@ -107,13 +107,11 @@ class ConfigManager {
    */
    */
   async updateConfigs(configs) {
   async updateConfigs(configs) {
     for (const config of configs) {
     for (const config of configs) {
-      this.configModel.findOneAndUpdate(
+      await this.configModel.findOneAndUpdate(
         { ns: config.ns, key: config.key },
         { ns: config.ns, key: config.key },
         { ns: config.ns, key: config.key, value: JSON.stringify(config.value) },
         { ns: config.ns, key: config.key, value: JSON.stringify(config.value) },
-        { upsert: true, },
-        function(err, config) {
-          debug('ConfigManager#updateConfigs', err, config);
-        });
+        { upsert: true, }
+      ).exec();
     }
     }
 
 
     await this.loadConfigs();
     await this.loadConfigs();