Merge branch 'master' into budi-8349-in-memory-search-parity-testing
This commit is contained in:
commit
909cf3f4f5
|
@ -33,7 +33,8 @@
|
|||
</Body>
|
||||
</Layout>
|
||||
<Button
|
||||
on:click={() => (window.location = "https://docs.budibase.com")}
|
||||
on:click={() =>
|
||||
(window.location = "https://docs.budibase.com/docs/migrations")}
|
||||
>Migration guide</Button
|
||||
>
|
||||
{/if}
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
<script>
|
||||
export let isMigrationDone
|
||||
export let onMigrationDone
|
||||
export let timeoutSeconds = 10 // 3 minutes
|
||||
export let timeoutSeconds = 60 // 1 minute
|
||||
export let minTimeSeconds = 3
|
||||
|
||||
const loadTime = Date.now()
|
||||
const intervalMs = 1000
|
||||
let timedOut = false
|
||||
let secondsWaited = 0
|
||||
|
||||
async function checkMigrationsFinished() {
|
||||
setTimeout(async () => {
|
||||
const isMigrated = await isMigrationDone()
|
||||
|
||||
const timeoutMs = timeoutSeconds * 1000
|
||||
if (!isMigrated) {
|
||||
if (!isMigrated || secondsWaited <= minTimeSeconds) {
|
||||
if (loadTime + timeoutMs > Date.now()) {
|
||||
secondsWaited += 1
|
||||
return checkMigrationsFinished()
|
||||
}
|
||||
|
||||
|
@ -20,7 +24,7 @@
|
|||
}
|
||||
|
||||
onMigrationDone()
|
||||
}, 1000)
|
||||
}, intervalMs)
|
||||
}
|
||||
|
||||
checkMigrationsFinished()
|
||||
|
@ -41,6 +45,11 @@
|
|||
<span class="subtext">
|
||||
{#if !timedOut}
|
||||
Please wait and we will be back in a second!
|
||||
<br />
|
||||
Checkout the
|
||||
<a href="https://docs.budibase.com/docs/app-migrations" target="_blank"
|
||||
>documentation</a
|
||||
> on app migrations.
|
||||
{:else}
|
||||
An error occurred, please try again later.
|
||||
<br />
|
||||
|
|
|
@ -23,16 +23,15 @@ const getCacheKey = (appId: string) => `appmigrations_${env.VERSION}_${appId}`
|
|||
export async function getAppMigrationVersion(appId: string): Promise<string> {
|
||||
const cacheKey = getCacheKey(appId)
|
||||
|
||||
let metadata: AppMigrationDoc | undefined = await cache.get(cacheKey)
|
||||
let version: string | undefined = await cache.get(cacheKey)
|
||||
|
||||
// returned cached version if we found one
|
||||
if (metadata?.version) {
|
||||
return metadata.version
|
||||
if (version) {
|
||||
return version
|
||||
}
|
||||
|
||||
let version
|
||||
try {
|
||||
metadata = await getFromDB(appId)
|
||||
const metadata = await getFromDB(appId)
|
||||
version = metadata.version || ""
|
||||
} catch (err: any) {
|
||||
if (err.status !== 404) {
|
||||
|
|
Loading…
Reference in New Issue