fix: add review comment debug logs again

need to debug this a bit more, seems to not work 100% of the time

This reverts commit cd2affbaaa.
This commit is contained in:
shiftinv 2022-09-05 21:18:22 +02:00
parent aecaf409e6
commit 9cc31baa58
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { TTL } from "../deps.ts";
import { log, TTL } from "../deps.ts";
import { UrlConfig } from "./types.d.ts";
const reviewComments = new TTL<number>(2 * 1000);
@ -44,6 +44,8 @@ export default function filter(headers: Headers, json: any, config: UrlConfig):
const reviewId: number = json.comment?.pull_request_review_id;
if (config.commentBurstLimit && reviewId) {
const cacheKey = `${reviewId}-${login}`;
log.debug(`filter: checking cache key ${cacheKey}`);
log.debug(`filter: full comment cache ${JSON.stringify(Array.from(reviewComments))}`);
const curr = reviewComments.get(cacheKey);
if (curr && curr >= config.commentBurstLimit) {
return `exceeded comment burst limit (${config.commentBurstLimit}) for review ${reviewId}`;