itizawa 4 лет назад
Родитель
Сommit
d16ed64fe4
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      packages/slackbot-proxy/src/controllers/growi-to-slack.ts

+ 2 - 2
packages/slackbot-proxy/src/controllers/growi-to-slack.ts

@@ -3,6 +3,7 @@ import {
 } from '@tsed/common';
 } from '@tsed/common';
 import axios from 'axios';
 import axios from 'axios';
 import createError from 'http-errors';
 import createError from 'http-errors';
+import { addHours } from 'date-fns';
 
 
 import { WebAPICallResult } from '@slack/web-api';
 import { WebAPICallResult } from '@slack/web-api';
 
 
@@ -168,8 +169,7 @@ export class GrowiToSlackCtrl {
     logger.debug('relation test is success', order);
     logger.debug('relation test is success', order);
 
 
     // temporary cache for 48 hours
     // temporary cache for 48 hours
-    const now = new Date();
-    const expiredAtCommands = new Date(now.setHours(now.getHours() + 48));
+    const expiredAtCommands = addHours(new Date(), 48);
 
 
     // Transaction is not considered because it is used infrequently,
     // Transaction is not considered because it is used infrequently,
     const response = await this.relationRepository.createQueryBuilder('relation')
     const response = await this.relationRepository.createQueryBuilder('relation')