mirror of
https://github.com/elyby/chrly.git
synced 2024-09-29 23:27:12 +05:30
Fixes #9. Start GC loop for in-memory textures cache.
This commit is contained in:
parent
e81ca1520d
commit
5b4761e4e5
@ -4,7 +4,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased] - xxxx-xx-xx
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- GC for in-memory textures cache has not been initialized.
|
||||||
|
|
||||||
## [4.2.1] - 2019-05-06
|
## [4.2.1] - 2019-05-06
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -25,9 +25,12 @@ type inMemoryTexturesStorage struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CreateInMemoryTexturesStorage() *inMemoryTexturesStorage {
|
func CreateInMemoryTexturesStorage() *inMemoryTexturesStorage {
|
||||||
return &inMemoryTexturesStorage{
|
storage := &inMemoryTexturesStorage{
|
||||||
data: make(map[string]*inMemoryItem),
|
data: make(map[string]*inMemoryItem),
|
||||||
}
|
}
|
||||||
|
storage.Start()
|
||||||
|
|
||||||
|
return storage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *inMemoryTexturesStorage) Start() {
|
func (s *inMemoryTexturesStorage) Start() {
|
||||||
|
@ -178,8 +178,6 @@ func TestInMemoryTexturesStorage_GarbageCollection(t *testing.T) {
|
|||||||
storage.StoreTextures("dead24f9a4fa4877b7b04c8c6c72bb46", textures1)
|
storage.StoreTextures("dead24f9a4fa4877b7b04c8c6c72bb46", textures1)
|
||||||
storage.StoreTextures("b5d58475007d4f9e9ddd1403e2497579", textures2)
|
storage.StoreTextures("b5d58475007d4f9e9ddd1403e2497579", textures2)
|
||||||
|
|
||||||
storage.Start()
|
|
||||||
|
|
||||||
time.Sleep(inMemoryStorageGCPeriod + time.Millisecond) // Let it start first iteration
|
time.Sleep(inMemoryStorageGCPeriod + time.Millisecond) // Let it start first iteration
|
||||||
|
|
||||||
_, textures1Err := storage.GetTextures("dead24f9a4fa4877b7b04c8c6c72bb46")
|
_, textures1Err := storage.GetTextures("dead24f9a4fa4877b7b04c8c6c72bb46")
|
||||||
|
Loading…
Reference in New Issue
Block a user