Skip to content

Commit 17d82da

Browse files
committed
feat: support auto delete plugin inactivated in 10mins
1 parent 7118bcc commit 17d82da

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/mongo/models/plugins.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,12 @@ const pluginMongooseSchema = new Schema({
2424

2525
pluginMongooseSchema.index({ toolId: 1 }, { unique: true, sparse: true });
2626
pluginMongooseSchema.index({ type: 1 });
27+
pluginMongooseSchema.index(
28+
{ status: 1 },
29+
{
30+
expireAfterSeconds: 600, // 10 minutes = 600 seconds
31+
partialFilterExpression: { status: { $ne: 'active' } }
32+
}
33+
);
2734

2835
export const MongoPlugin = getMongoModel('fastgpt_plugins', pluginMongooseSchema);

0 commit comments

Comments
 (0)