fixed admin notification to async

This commit is contained in:
Roni Dover 2024-06-12 18:17:24 -07:00
parent dc99b95b10
commit 74724aa627

View file

@ -27,7 +27,7 @@ public class DomainValidationService {
saveValidationResults(domain, false, false); saveValidationResults(domain, false, false);
} }
notifyAdmin(domain); asyncNotifyAdmin(domain);
return true; return true;
} }
@ -84,6 +84,20 @@ public class DomainValidationService {
System.out.println("Notifying admin: " + notification); System.out.println("Notifying admin: " + notification);
} }
private void asyncNotifyAdmin(String domain) {
// Simulated notification: Creating a fake notification object and printing its
// contents
Notification notification = new Notification("admin@example.com", "Domain Validation Completed",
"Validation completed for domain: " + domain);
try {
Thread.sleep(2000);
}
catch (InterruptedException e) {
throw new RuntimeException(e);
}
System.out.println("Notifying admin: " + notification);
}
// Fake method to check if the domain is reserved // Fake method to check if the domain is reserved
private boolean isReservedDomain(String domain) { private boolean isReservedDomain(String domain) {
String[] reservedDomains = { "example.com", "localhost" }; String[] reservedDomains = { "example.com", "localhost" };