Skip to content

Commit 3573aed

Browse files
authored
Integrate session ping approach (#2625)
1 parent dc66680 commit 3573aed

720 files changed

Lines changed: 1050 additions & 985 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* This source file is available under the terms of the
3+
* Pimcore Open Core License (POCL)
4+
* Full copyright and license information is available in
5+
* LICENSE.md which is distributed with this source code.
6+
*
7+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
8+
* @license Pimcore Open Core License (POCL)
9+
*/
10+
11+
import { useEffect } from 'react'
12+
import { useSettings } from '@Pimcore/modules/app/settings/hooks/use-settings'
13+
import { useLazyPingActionQuery } from '@Pimcore/modules/app/settings/settings-slice-enhanced'
14+
15+
import { isNil } from 'lodash'
16+
17+
export const useSessionPing = (): void => {
18+
const { session_gc_maxlifetime: sessionGcMaxLifetime } = useSettings()
19+
const [triggerPing] = useLazyPingActionQuery()
20+
21+
useEffect(() => {
22+
if (isNil(sessionGcMaxLifetime)) {
23+
return
24+
}
25+
26+
const intervalTime = (Number(sessionGcMaxLifetime) - 60) * 1000
27+
28+
const interval = setInterval(() => {
29+
void triggerPing()
30+
}, intervalTime)
31+
32+
return () => {
33+
clearInterval(interval)
34+
}
35+
}, [sessionGcMaxLifetime, triggerPing])
36+
}

assets/js/src/core/modules/app/default-page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import { ClassDefinitionsProvider } from '../data-object/utils/provider/class-de
1515
import { ElementSelectorProvider } from '@sdk/modules/element'
1616
import { useHandleDeepLink } from './hook/use-handle-deeplink'
1717
import { SlotRenderer } from './component-registry/slot-renderer'
18+
import { useSessionPing } from './app-loader/loader/session/use-session-ping'
1819

1920
export const DefaultPage = (): React.JSX.Element => {
2021
useHandleDeepLink()
22+
useSessionPing()
2123

2224
const preventDrop = (event: React.DragEvent<HTMLDivElement>): void => {
2325
event.preventDefault()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* This source file is available under the terms of the
3+
* Pimcore Open Core License (POCL)
4+
* Full copyright and license information is available in
5+
* LICENSE.md which is distributed with this source code.
6+
*
7+
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
8+
* @license Pimcore Open Core License (POCL)
9+
*/
10+
11+
import { api as baseApi } from './settings-slice.gen'
12+
13+
const api = baseApi.enhanceEndpoints({
14+
endpoints: {}
15+
})
16+
17+
export const {
18+
useSystemSettingsGetQuery,
19+
useLazySystemSettingsGetQuery,
20+
useActiveBundlesGetQuery,
21+
useLazyActiveBundlesGetQuery,
22+
usePingActionQuery,
23+
useLazyPingActionQuery
24+
} = api
25+
26+
export { api }
27+
export type * from './settings-slice.gen'

public/build/39f4be8a-36ee-4532-82a5-72785f39aa87/entrypoints.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/9432c7bb-7f0a-408d-947d-1b3a1509b313/exposeRemote.js renamed to public/build/39f4be8a-36ee-4532-82a5-72785f39aa87/exposeRemote.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/9432c7bb-7f0a-408d-947d-1b3a1509b313/index.html renamed to public/build/39f4be8a-36ee-4532-82a5-72785f39aa87/index.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/39f4be8a-36ee-4532-82a5-72785f39aa87/manifest.json

Lines changed: 769 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)