mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-06-06 15:14:31 -04:00
@@ -1919,6 +1919,9 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
|
||||
"OCIS_EVENTS_ENABLE_TLS": False,
|
||||
"MICRO_REGISTRY": "natsjs",
|
||||
"MICRO_REGISTRY_ADDRESS": "127.0.0.1:9233",
|
||||
"OCIS_CACHE_STORE": "nats-js-kv",
|
||||
"OCIS_CACHE_STORE_NODES": "127.0.0.1:9233",
|
||||
"OCIS_CACHE_DATABASE": "cache",
|
||||
}
|
||||
|
||||
if deploy_type == "":
|
||||
|
||||
5
changelog/unreleased/fix-natsjs-cache.md
Normal file
5
changelog/unreleased/fix-natsjs-cache.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Bugfix: Fix natsjs cache
|
||||
|
||||
The nats-js cache was not working. It paniced and wrote a lot of error logs. Both is fixed now.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/7790
|
||||
@@ -64,6 +64,8 @@ import (
|
||||
var (
|
||||
// runset keeps track of which services to start supervised.
|
||||
runset map[string]struct{}
|
||||
// time to wait after starting the preliminary services
|
||||
_preliminaryDelay = 6 * time.Second
|
||||
// time to wait between starting service groups (preliminary, main, delayed)
|
||||
_startDelay = 2 * time.Second
|
||||
)
|
||||
@@ -413,8 +415,8 @@ func Start(o ...Option) error {
|
||||
// trap will block on halt channel for interruptions.
|
||||
go trap(s, halt)
|
||||
|
||||
// grace period for supervisor to get up
|
||||
time.Sleep(_startDelay)
|
||||
// grace period for preliminary services to get up
|
||||
time.Sleep(_preliminaryDelay)
|
||||
|
||||
// schedule services that we are sure don't have interdependencies.
|
||||
scheduleServiceTokens(s, s.ServicesRegistry)
|
||||
|
||||
@@ -85,7 +85,7 @@ type StorageRegistry struct {
|
||||
|
||||
// Cache holds cache config
|
||||
type Cache struct {
|
||||
StatCacheStore string `yaml:"stat_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."`
|
||||
StatCacheStore string // TODO: enable configuring this again // `yaml:"stat_cache_store" env:"OCIS_CACHE_STORE;GATEWAY_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."`
|
||||
StatCacheNodes []string `yaml:"stat_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_STAT_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details."`
|
||||
StatCacheDatabase string `yaml:"stat_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."`
|
||||
StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details."`
|
||||
|
||||
@@ -103,6 +103,11 @@ func DefaultConfig() *config.Config {
|
||||
Database: "ocis",
|
||||
TTL: 24 * 60 * time.Second,
|
||||
},
|
||||
IDCache: config.IDCache{
|
||||
Store: "nats-js-kv",
|
||||
Database: "ocis",
|
||||
TTL: 24 * 60 * time.Second,
|
||||
},
|
||||
Tasks: config.Tasks{
|
||||
PurgeTrashBin: config.PurgeTrashBin{
|
||||
ProjectDeleteBefore: 30 * 24 * time.Hour,
|
||||
|
||||
@@ -128,7 +128,7 @@ func WaitForConnection() bool {
|
||||
Transport: transport,
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest("GET", config.Get("url")+"/graph/v1.0/users/"+config.Get("adminUsername"), nil)
|
||||
req, _ := http.NewRequest("GET", config.Get("url")+"/graph/v1.0/me/drives", nil)
|
||||
req.SetBasicAuth(config.Get("adminUsername"), config.Get("adminPassword"))
|
||||
|
||||
timeout := time.After(timeoutValue)
|
||||
|
||||
@@ -275,9 +275,7 @@ func (MessagePackBackend) IsMetaFile(path string) bool {
|
||||
|
||||
// Purge purges the data of a given path
|
||||
func (b MessagePackBackend) Purge(path string) error {
|
||||
if err := b.metaCache.RemoveMetadata(b.cacheKey(path)); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = b.metaCache.RemoveMetadata(b.cacheKey(path))
|
||||
return os.Remove(b.MetadataPath(path))
|
||||
}
|
||||
|
||||
@@ -291,10 +289,7 @@ func (b MessagePackBackend) Rename(oldPath, newPath string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
err = b.metaCache.RemoveMetadata(b.cacheKey(oldPath))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = b.metaCache.RemoveMetadata(b.cacheKey(oldPath))
|
||||
|
||||
return os.Rename(b.MetadataPath(oldPath), b.MetadataPath(newPath))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user