Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksptang committed Jan 27, 2025
1 parent a0389d1 commit 22b18c1
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* Accesses JIRA to raise a support request.
*/
@Singleton

public class SupportRequestServiceImpl implements SupportRequestService {
public static final int ERROR_START = 400;
public static final String JIRA_USER = "jira.user";
Expand Down Expand Up @@ -157,11 +156,11 @@ private String createJiraRequest(final String summary, final String description,
long currentTime = System.currentTimeMillis();
int repeatedCount = 0;
if (escapedEmail.equals("sample@email.tst")) // This is an email which was used by a robot generating hundreds of feedbacks on Jan 27, 2025
repeatedCount = 10;
repeatedCount = 4;
else {
previousEmails[feedbackCounts % 10] = email;
previousEmails[feedbackCounts % 10] = escapedEmail;
previousTimes[feedbackCounts % 10] = currentTime;
feedbackCounts++;
feedbackCounts ++;
for (int i = 0; i < previousEmails.length; i++) {
if ((escapedEmail.equals(previousEmails[i])) && (currentTime - previousTimes[i] < 3600000)) // 1 hour
repeatedCount++;
Expand All @@ -170,7 +169,7 @@ private String createJiraRequest(final String summary, final String description,

try {
if (repeatedCount > 3) {
log.warn("Ignored repeated feedbacks with same email: " + escapedEmail +
System.out.println("Ignored repeated feedbacks with same email: " + escapedEmail +
", summary: " + escapedSummary + ", description: " + escapedDescription +
", URL: " + escapedUrl + ", type: " + escapedType);
return handleHttpResponseFailure(response, null);
Expand Down

0 comments on commit 22b18c1

Please sign in to comment.