fix: while waiting some other thread could have generated the thumbnail
This commit is contained in:
parent
28d526ab74
commit
c148adb225
@ -72,6 +72,14 @@ func GetThumbnail(c *fiber.Ctx, completePath string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
WaitForAvailable()
|
WaitForAvailable()
|
||||||
|
/* While waiting some other thread could have generated the thumbnail */
|
||||||
|
thumbnailCacheMutex.RLock()
|
||||||
|
bytesThumb, ok = thumbnailCache[completePath]
|
||||||
|
thumbnailCacheMutex.RUnlock()
|
||||||
|
if ok {
|
||||||
|
c.Write(bytesThumb)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
fileExt := filepath.Ext(completePath)
|
fileExt := filepath.Ext(completePath)
|
||||||
if !slices.Contains(SupportedFileTypes, fileExt) {
|
if !slices.Contains(SupportedFileTypes, fileExt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user