chore: refresh datasource (#5980)

This commit is contained in:
ChengLei Shao 2025-01-01 22:47:42 +08:00 committed by GitHub
parent c1eb366701
commit 2eb03c21e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -77,8 +77,13 @@ export class DataSourceModel extends Model {
}
}
async loadIntoApplication(options: { app: Application; transaction?: Transaction; loadAtAfterStart?: boolean }) {
const { app, loadAtAfterStart } = options;
async loadIntoApplication(options: {
app: Application;
transaction?: Transaction;
loadAtAfterStart?: boolean;
refresh?: boolean;
}) {
const { app, loadAtAfterStart, refresh } = options;
const dataSourceKey = this.get('key');
@ -129,6 +134,7 @@ export class DataSourceModel extends Model {
await app.dataSourceManager.add(dataSource, {
localData: await this.loadLocalData(),
refresh,
});
} catch (e) {
app.logger.error(`load data source failed`, { cause: e });

View File

@ -427,6 +427,7 @@ export class PluginDataSourceManagerServer extends Plugin {
) {
dataSourceModel.loadIntoApplication({
app: ctx.app,
refresh: true,
});
ctx.app.syncMessageManager.publish(self.name, {