Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into staging
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo committed Dec 13, 2024
2 parents 45ad737 + 942a6c7 commit bc3cf5e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
7 changes: 7 additions & 0 deletions server/account/src/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,10 @@ export async function listWorkspaces (
): Promise<WorkspaceInfo[]> {
decodeToken(ctx, token) // Just verify token is valid

if (region === '') {
region = null
}

return (await db.workspace.find(region != null ? { region } : {}))
.filter((it) => it.disabled !== true)
.map(trimWorkspaceInfo)
Expand Down Expand Up @@ -903,6 +907,9 @@ export async function countWorkspacesInRegion (
* @public
*/
export async function listWorkspacesRaw (db: AccountDB, region?: string): Promise<Workspace[]> {
if (region === '') {
region = undefined
}
return (await db.workspace.find(region !== undefined ? { region } : {})).filter((it) => it.disabled !== true)
}

Expand Down
6 changes: 6 additions & 0 deletions server/backup/src/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,7 @@ export async function restore (
storageAdapter?: StorageAdapter
token?: string
progress?: (progress: number) => Promise<void>
cleanIndexState?: boolean
}
): Promise<boolean> {
const infoFile = 'backup.json.gz'
Expand Down Expand Up @@ -1845,6 +1846,11 @@ export async function restore (
tx.objectSpace = core.space.Workspace
}
}
if (opt.cleanIndexState === true) {
if (d._class === core.class.DocIndexState) {
;(d as DocIndexState).needIndex = true
}
}
}

if (opt.recheck === true) {
Expand Down
8 changes: 2 additions & 6 deletions server/backup/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,8 @@ export async function doRestoreWorkspace (
bucketName: string,
pipelineFactory: PipelineFactory,
workspaceStorageAdapter: StorageAdapter,
getConfig: (
ctx: MeasureContext,
workspace: WorkspaceIdWithUrl,
branding: Branding | null,
externalStorage: StorageAdapter
) => DbConfiguration,
skipDomains: string[],
cleanIndexState: boolean,
notify?: (progress: number) => Promise<void>
): Promise<boolean> {
rootCtx.warn('\nRESTORE WORKSPACE ', {
Expand All @@ -374,6 +369,7 @@ export async function doRestoreWorkspace (
skip: new Set(skipDomains),
recheck: true,
storageAdapter: workspaceStorageAdapter,
cleanIndexState,
getConnection: async () => {
if (pipeline === undefined) {
pipeline = await pipelineFactory(ctx, wsUrl, true, () => {}, null)
Expand Down
7 changes: 1 addition & 6 deletions server/workspace-service/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,8 @@ export class WorkspaceWorker {
opt.backup.bucketName,
pipelineFactory,
workspaceStorageAdapter,
(ctx, workspace, branding, externalStorage) => {
return getConfig(ctx, dbUrl, ctx, {
externalStorage,
disableTriggers: true
})
},
['blob'],
true,
(_p: number) => {
if (progress !== Math.round(_p)) {
progress = Math.round(_p)
Expand Down

0 comments on commit bc3cf5e

Please sign in to comment.