Skip to content

Commit

Permalink
fix: plugin cache reload
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoushilin authored and LinkinStars committed Jan 19, 2024
1 parent d8c5577 commit 6d93b7d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/service/plugin_common/plugin_common_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ package plugin_common
import (
"context"
"encoding/json"

"github.com/apache/incubator-answer/internal/base/data"
"github.com/apache/incubator-answer/internal/repo/search_sync"

"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"

"github.com/apache/incubator-answer/internal/base/constant"
"github.com/apache/incubator-answer/internal/base/reason"
"github.com/apache/incubator-answer/internal/entity"
"github.com/apache/incubator-answer/internal/schema"
"github.com/apache/incubator-answer/internal/service/config"
"github.com/apache/incubator-answer/plugin"
"github.com/segmentfault/pacman/errors"
"github.com/segmentfault/pacman/log"
)

type PluginConfigRepo interface {
Expand Down Expand Up @@ -79,6 +81,16 @@ func NewPluginCommonService(
if err != nil {
log.Errorf("parse plugin config failed: %s %v", pluginConfig.PluginSlugName, err)
}

err = plugin.CallCache(func(cache plugin.Cache) error {
if cache.Info().SlugName == pluginConfig.PluginSlugName {
data.Cache = cache
}
return nil
})
if err != nil {
log.Errorf("parse plugin cache failed: %s %v", pluginConfig.PluginSlugName, err)
}
}
}

Expand Down

0 comments on commit 6d93b7d

Please sign in to comment.