Skip to content

Commit

Permalink
修复异步错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Oct 7, 2024
1 parent e5b73b2 commit b304ab6
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
import com.ghostchu.btn.sparkle.module.audit.impl.AuditRepository;
import com.ghostchu.btn.sparkle.util.IPUtil;
import com.ghostchu.btn.sparkle.util.ServletUtil;
import jakarta.persistence.LockModeType;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;

Expand All @@ -25,9 +21,6 @@ public AuditService(AuditRepository auditRepository) {
this.auditRepository = auditRepository;
}

@Async
@Transactional
@Lock(LockModeType.PESSIMISTIC_WRITE)
public void log(HttpServletRequest req, String action, boolean success, Map<String, Object> node) {
var audit = new Audit(null, OffsetDateTime.now(), IPUtil.toInet(ServletUtil.getIP(req)), action, success, getHeaders(req), node);
auditRepository.save(audit);
Expand Down

0 comments on commit b304ab6

Please sign in to comment.