mirror of
https://github.com/mudler/luet.git
synced 2025-09-12 21:33:31 +00:00
Be sure to cache packages with same fingerprint only once
this makes sure that we are fast to process also invalid trees
This commit is contained in:
@@ -41,6 +41,7 @@ type InMemoryDatabase struct {
|
||||
CacheNoVersion map[string]map[string]interface{}
|
||||
ProvidesDatabase map[string]map[string]Package
|
||||
RevDepsDatabase map[string]map[string]Package
|
||||
cached map[string]interface{}
|
||||
}
|
||||
|
||||
func NewInMemoryDatabase(singleton bool) PackageDatabase {
|
||||
@@ -53,6 +54,7 @@ func NewInMemoryDatabase(singleton bool) PackageDatabase {
|
||||
CacheNoVersion: map[string]map[string]interface{}{},
|
||||
ProvidesDatabase: map[string]map[string]Package{},
|
||||
RevDepsDatabase: map[string]map[string]Package{},
|
||||
cached: map[string]interface{}{},
|
||||
}
|
||||
}
|
||||
return DBInMemoryInstance
|
||||
@@ -197,6 +199,11 @@ func (db *InMemoryDatabase) populateCaches(p Package) {
|
||||
|
||||
// Create extra cache between package -> []versions
|
||||
db.Lock()
|
||||
if _, ok := db.cached[p.GetFingerPrint()]; ok {
|
||||
db.Unlock()
|
||||
return
|
||||
}
|
||||
db.cached[p.GetFingerPrint()] = nil
|
||||
|
||||
// Provides: Store package provides, we will reuse this when walking deps
|
||||
for _, provide := range pd.Provides {
|
||||
|
Reference in New Issue
Block a user