javax.persistence.query.timeout with slowQuery repository for manual testing
This commit is contained in:
parent
228fddb8cd
commit
d1855ee400
@ -472,6 +472,8 @@ spring:
|
||||
repositories:
|
||||
enabled: "true"
|
||||
jpa:
|
||||
properties:
|
||||
javax.persistence.query.timeout: "${JAVAX_PERSISTENCE_QUERY_TIMEOUT:29000}"
|
||||
open-in-view: "false"
|
||||
hibernate:
|
||||
ddl-auto: "none"
|
||||
|
||||
@ -241,4 +241,10 @@ public interface EventRepository extends PagingAndSortingRepository<EventEntity,
|
||||
@Param("errorsOccurred") Integer errorsOccurred,
|
||||
Pageable pageable);
|
||||
|
||||
/**
|
||||
* Sleep 3 second on JPA connection
|
||||
* */
|
||||
@Query(value = "select count(*) from pg_sleep(3)", nativeQuery = true)
|
||||
Long slowQuery();
|
||||
|
||||
}
|
||||
|
||||
@ -144,6 +144,14 @@ public class JpaBaseEventDao extends JpaAbstractDao<EventEntity, Event> implemen
|
||||
|
||||
@Override
|
||||
public PageData<Event> findEvents(UUID tenantId, EntityId entityId, String eventType, TimePageLink pageLink) {
|
||||
log.warn("going to run slow query");
|
||||
try {
|
||||
eventRepository.slowQuery();
|
||||
} catch (Exception e) {
|
||||
log.error("slowQuery" , e);
|
||||
throw e;
|
||||
}
|
||||
log.warn("finished slow query");
|
||||
return DaoUtil.toPageData(
|
||||
eventRepository
|
||||
.findEventsByTenantIdAndEntityIdAndEventType(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user