mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
* Log 3 unchecked errors Rather than ignore errors, log them at the WARNING log level. The server has been functioning without these, so assume they are not at the ERROR level. * Log errors in concurrency test If we can't initialize the configuration, treat the test as a failure. * Undo the errcheck on configurations for now. * Handle unchecked errors in pkg/manager * Resolve unchecked errors * Handle DLNA/DMS unchecked errors * Handle error checking in concurrency test Generalize config initialization, so we can initialize a configuration without writing it to disk. Use this in the test case, since otherwise the test fails to write. * Handle the remaining unchecked errors * Heed gosimple in update test * Use one-line if-initializer statements While here, fix a wrong variable capture error. * testing.T doesn't support %w use %v instead which is supported. * Remove unused query builder functions The Int/String criterion handler functions are now generalized. Thus, there's no need to keep these functions around anymore. * Mark filterBuilder.addRecursiveWith nolint The function is useful in the future and no other refactors are looking nice. Keep the function around, but tell the linter to ignore it. * Remove utils.Btoi There are no users of this utility function * Return error on scan failure If we fail to scan the row when looking for the unique checksum index, then report the error upwards. * Fix comments on exported functions * Fix typos * Fix startup error
103 lines
3.6 KiB
Go
103 lines
3.6 KiB
Go
package config
|
|
|
|
import (
|
|
"sync"
|
|
"testing"
|
|
)
|
|
|
|
// should be run with -race
|
|
func TestConcurrentConfigAccess(t *testing.T) {
|
|
i := GetInstance()
|
|
|
|
const workers = 8
|
|
//const loops = 1000
|
|
const loops = 200
|
|
var wg sync.WaitGroup
|
|
for k := 0; k < workers; k++ {
|
|
wg.Add(1)
|
|
go func(wk int) {
|
|
for l := 0; l < loops; l++ {
|
|
if err := i.SetInitialMemoryConfig(); err != nil {
|
|
t.Errorf("Failure setting initial configuration in worker %v iteration %v: %v", wk, l, err)
|
|
}
|
|
|
|
i.HasCredentials()
|
|
i.GetCPUProfilePath()
|
|
i.GetConfigFile()
|
|
i.GetConfigPath()
|
|
i.GetDefaultDatabaseFilePath()
|
|
i.GetStashPaths()
|
|
i.GetConfigFilePath()
|
|
i.Set(Cache, i.GetCachePath())
|
|
i.Set(Generated, i.GetGeneratedPath())
|
|
i.Set(Metadata, i.GetMetadataPath())
|
|
i.Set(Database, i.GetDatabasePath())
|
|
i.Set(JWTSignKey, i.GetJWTSignKey())
|
|
i.Set(SessionStoreKey, i.GetSessionStoreKey())
|
|
i.GetDefaultScrapersPath()
|
|
i.Set(Exclude, i.GetExcludes())
|
|
i.Set(ImageExclude, i.GetImageExcludes())
|
|
i.Set(VideoExtensions, i.GetVideoExtensions())
|
|
i.Set(ImageExtensions, i.GetImageExtensions())
|
|
i.Set(GalleryExtensions, i.GetGalleryExtensions())
|
|
i.Set(CreateGalleriesFromFolders, i.GetCreateGalleriesFromFolders())
|
|
i.Set(Language, i.GetLanguage())
|
|
i.Set(VideoFileNamingAlgorithm, i.GetVideoFileNamingAlgorithm())
|
|
i.Set(ScrapersPath, i.GetScrapersPath())
|
|
i.Set(ScraperUserAgent, i.GetScraperUserAgent())
|
|
i.Set(ScraperCDPPath, i.GetScraperCDPPath())
|
|
i.Set(ScraperCertCheck, i.GetScraperCertCheck())
|
|
i.Set(ScraperExcludeTagPatterns, i.GetScraperExcludeTagPatterns())
|
|
i.Set(StashBoxes, i.GetStashBoxes())
|
|
i.GetDefaultPluginsPath()
|
|
i.Set(PluginsPath, i.GetPluginsPath())
|
|
i.Set(Host, i.GetHost())
|
|
i.Set(Port, i.GetPort())
|
|
i.Set(ExternalHost, i.GetExternalHost())
|
|
i.Set(PreviewSegmentDuration, i.GetPreviewSegmentDuration())
|
|
i.Set(ParallelTasks, i.GetParallelTasks())
|
|
i.Set(ParallelTasks, i.GetParallelTasksWithAutoDetection())
|
|
i.Set(PreviewAudio, i.GetPreviewAudio())
|
|
i.Set(PreviewSegments, i.GetPreviewSegments())
|
|
i.Set(PreviewExcludeStart, i.GetPreviewExcludeStart())
|
|
i.Set(PreviewExcludeEnd, i.GetPreviewExcludeEnd())
|
|
i.Set(PreviewPreset, i.GetPreviewPreset())
|
|
i.Set(MaxTranscodeSize, i.GetMaxTranscodeSize())
|
|
i.Set(MaxStreamingTranscodeSize, i.GetMaxStreamingTranscodeSize())
|
|
i.Set(ApiKey, i.GetAPIKey())
|
|
i.Set(Username, i.GetUsername())
|
|
i.Set(Password, i.GetPasswordHash())
|
|
i.GetCredentials()
|
|
i.Set(MaxSessionAge, i.GetMaxSessionAge())
|
|
i.Set(CustomServedFolders, i.GetCustomServedFolders())
|
|
i.Set(CustomUILocation, i.GetCustomUILocation())
|
|
i.Set(MenuItems, i.GetMenuItems())
|
|
i.Set(SoundOnPreview, i.GetSoundOnPreview())
|
|
i.Set(WallShowTitle, i.GetWallShowTitle())
|
|
i.Set(CustomPerformerImageLocation, i.GetCustomPerformerImageLocation())
|
|
i.Set(WallPlayback, i.GetWallPlayback())
|
|
i.Set(MaximumLoopDuration, i.GetMaximumLoopDuration())
|
|
i.Set(AutostartVideo, i.GetAutostartVideo())
|
|
i.Set(ShowStudioAsText, i.GetShowStudioAsText())
|
|
i.Set(SlideshowDelay, i.GetSlideshowDelay())
|
|
i.GetCSSPath()
|
|
i.GetCSS()
|
|
i.Set(CSSEnabled, i.GetCSSEnabled())
|
|
i.Set(HandyKey, i.GetHandyKey())
|
|
i.Set(DLNAServerName, i.GetDLNAServerName())
|
|
i.Set(DLNADefaultEnabled, i.GetDLNADefaultEnabled())
|
|
i.Set(DLNADefaultIPWhitelist, i.GetDLNADefaultIPWhitelist())
|
|
i.Set(DLNAInterfaces, i.GetDLNAInterfaces())
|
|
i.Set(LogFile, i.GetLogFile())
|
|
i.Set(LogOut, i.GetLogOut())
|
|
i.Set(LogLevel, i.GetLogLevel())
|
|
i.Set(LogAccess, i.GetLogAccess())
|
|
i.Set(MaxUploadSize, i.GetMaxUploadSize())
|
|
}
|
|
wg.Done()
|
|
}(k)
|
|
}
|
|
|
|
wg.Wait()
|
|
}
|