1
0
Fork 0
mirror of synced 2024-08-31 09:41:13 +12:00

Merge pull request #7953 from Budibase/fix/7952

Fix for plugin quotas
This commit is contained in:
Michael Drury 2022-09-24 20:07:16 +01:00 committed by GitHub
commit fb2208d823
5 changed files with 30 additions and 1 deletions

View file

@ -33,4 +33,8 @@ export const DEFINITIONS: MigrationDefinition[] = [
type: MigrationType.GLOBAL, type: MigrationType.GLOBAL,
name: MigrationName.GLOBAL_INFO_SYNC_USERS, name: MigrationName.GLOBAL_INFO_SYNC_USERS,
}, },
{
type: MigrationType.GLOBAL,
name: MigrationName.PLUGIN_COUNT,
},
] ]

View file

@ -0,0 +1,12 @@
import { tenancy, logging } from "@budibase/backend-core"
import { plugins } from "@budibase/pro"
export const run = async () => {
try {
await tenancy.doInTenant(tenancy.DEFAULT_TENANT_ID, async () => {
await plugins.checkPluginQuotas()
})
} catch (err) {
logging.logAlert("Failed to update plugin quotas", err)
}
}

View file

@ -7,6 +7,7 @@ import * as userEmailViewCasing from "./functions/userEmailViewCasing"
import * as quota1 from "./functions/quotas1" import * as quota1 from "./functions/quotas1"
import * as appUrls from "./functions/appUrls" import * as appUrls from "./functions/appUrls"
import * as backfill from "./functions/backfill" import * as backfill from "./functions/backfill"
import * as pluginCount from "./functions/pluginCount"
/** /**
* Populate the migration function and additional configuration from * Populate the migration function and additional configuration from
@ -68,6 +69,16 @@ export const buildMigrations = () => {
}) })
break break
} }
case MigrationName.PLUGIN_COUNT: {
if (env.SELF_HOSTED) {
serverMigrations.push({
...definition,
fn: pluginCount.run,
silent: !!env.SELF_HOSTED,
preventRetry: false,
})
}
}
} }
} }

View file

@ -46,6 +46,7 @@ export enum MigrationName {
EVENT_INSTALLATION_BACKFILL = "event_installation_backfill", EVENT_INSTALLATION_BACKFILL = "event_installation_backfill",
GLOBAL_INFO_SYNC_USERS = "global_info_sync_users", GLOBAL_INFO_SYNC_USERS = "global_info_sync_users",
PLATFORM_USERS_EMAIL_CASING = "platform_users_email_casing", PLATFORM_USERS_EMAIL_CASING = "platform_users_email_casing",
PLUGIN_COUNT = "plugin_count",
} }
export interface MigrationDefinition { export interface MigrationDefinition {

View file

@ -32,7 +32,8 @@ describe("Public API - /rows endpoints", () => {
expect(row._id).toBeDefined() expect(row._id).toBeDefined()
}) })
it("POST - Search rows", async () => { // search really isn't supported
xit("POST - Search rows", async () => {
const [response, rows] = await config.rows.search({ const [response, rows] = await config.rows.search({
query: { query: {
string: { string: {