feat(xo-server/metadata-backups): clear backup listing cache on change (#4672)
See 471f39741
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
- [Metadata backup] Add 10 minutes timeout to avoid stuck jobs [#4657](https://github.com/vatesfr/xen-orchestra/issues/4657) (PR [#4666](https://github.com/vatesfr/xen-orchestra/pull/4666))
|
||||
- [Metadata backups] Fix out-of-date listing for 1 minute due to cache (PR [#4672](https://github.com/vatesfr/xen-orchestra/pull/4672))
|
||||
|
||||
### Released packages
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import asyncMap from '@xen-orchestra/async-map'
|
||||
import createLogger from '@xen-orchestra/log'
|
||||
import { fromEvent, ignoreErrors, timeout } from 'promise-toolbox'
|
||||
|
||||
import { debounceWithKey } from '../_pDebounceWithKey'
|
||||
import { debounceWithKey, REMOVE_CACHE_ENTRY } from '../_pDebounceWithKey'
|
||||
import { waitAll } from '../_waitAll'
|
||||
import parseDuration from '../_parseDuration'
|
||||
import { type Xapi } from '../xapi'
|
||||
@@ -251,6 +251,8 @@ export default class metadataBackup {
|
||||
taskId: subTaskId,
|
||||
}
|
||||
)
|
||||
|
||||
this._listXoMetadataBackups(REMOVE_CACHE_ENTRY, remoteId)
|
||||
} catch (error) {
|
||||
await handler.rmtree(dir).catch(error => {
|
||||
logger.warning(`unable to delete the folder ${dir}`, {
|
||||
@@ -396,6 +398,8 @@ export default class metadataBackup {
|
||||
taskId: subTaskId,
|
||||
}
|
||||
)
|
||||
|
||||
this._listPoolMetadataBackups(REMOVE_CACHE_ENTRY, remoteId)
|
||||
} catch (error) {
|
||||
if (outputStream !== undefined) {
|
||||
outputStream.destroy()
|
||||
@@ -812,6 +816,12 @@ export default class metadataBackup {
|
||||
const [remoteId, ...path] = id.split('/')
|
||||
|
||||
const handler = await app.getRemoteHandler(remoteId)
|
||||
return handler.rmtree(path.join('/'))
|
||||
await handler.rmtree(path.join('/'))
|
||||
|
||||
if (path[0] === 'xo-config-backups') {
|
||||
this._listXoMetadataBackups(REMOVE_CACHE_ENTRY, remoteId)
|
||||
} else {
|
||||
this._listPoolMetadataBackups(REMOVE_CACHE_ENTRY, remoteId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user