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:
|
repositories:
|
||||||
enabled: "true"
|
enabled: "true"
|
||||||
jpa:
|
jpa:
|
||||||
|
properties:
|
||||||
|
javax.persistence.query.timeout: "${JAVAX_PERSISTENCE_QUERY_TIMEOUT:29000}"
|
||||||
open-in-view: "false"
|
open-in-view: "false"
|
||||||
hibernate:
|
hibernate:
|
||||||
ddl-auto: "none"
|
ddl-auto: "none"
|
||||||
|
|||||||
@ -241,4 +241,10 @@ public interface EventRepository extends PagingAndSortingRepository<EventEntity,
|
|||||||
@Param("errorsOccurred") Integer errorsOccurred,
|
@Param("errorsOccurred") Integer errorsOccurred,
|
||||||
Pageable pageable);
|
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
|
@Override
|
||||||
public PageData<Event> findEvents(UUID tenantId, EntityId entityId, String eventType, TimePageLink pageLink) {
|
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(
|
return DaoUtil.toPageData(
|
||||||
eventRepository
|
eventRepository
|
||||||
.findEventsByTenantIdAndEntityIdAndEventType(
|
.findEventsByTenantIdAndEntityIdAndEventType(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user