Fix race condition, introduced in the previous commit

This commit is contained in:
ErickSkrauch 2019-06-19 00:56:09 +03:00
parent 5b4761e4e5
commit f872fe4698
3 changed files with 5 additions and 2 deletions

View File

@ -28,7 +28,6 @@ func CreateInMemoryTexturesStorage() *inMemoryTexturesStorage {
storage := &inMemoryTexturesStorage{
data: make(map[string]*inMemoryItem),
}
storage.Start()
return storage
}

View File

@ -178,6 +178,8 @@ func TestInMemoryTexturesStorage_GarbageCollection(t *testing.T) {
storage.StoreTextures("dead24f9a4fa4877b7b04c8c6c72bb46", textures1)
storage.StoreTextures("b5d58475007d4f9e9ddd1403e2497579", textures2)
storage.Start()
time.Sleep(inMemoryStorageGCPeriod + time.Millisecond) // Let it start first iteration
_, textures1Err := storage.GetTextures("dead24f9a4fa4877b7b04c8c6c72bb46")

View File

@ -51,11 +51,13 @@ var serveCmd = &cobra.Command{
return
}
texturesStorage := queue.CreateInMemoryTexturesStorage()
texturesStorage.Start()
mojangTexturesQueue := &queue.JobsQueue{
Logger: logger,
Storage: &queue.SplittedStorage{
UuidsStorage: mojangUuidsRepository,
TexturesStorage: queue.CreateInMemoryTexturesStorage(),
TexturesStorage: texturesStorage,
},
}
logger.Info("Mojang's textures queue is successfully initialized")