mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-09 07:28:44 -07:00
refactor(vips)
This commit is contained in:
parent
5d13fba8be
commit
a29fa25dfc
4 changed files with 22 additions and 9 deletions
10
vips.go
10
vips.go
|
|
@ -15,6 +15,11 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
maxCacheMem = 100 * 1024 * 1024
|
||||
maxCacheSize = 500
|
||||
)
|
||||
|
||||
var (
|
||||
m sync.Mutex
|
||||
initialized bool
|
||||
|
|
@ -67,8 +72,9 @@ func Initialize() {
|
|||
panic("unable to start vips!")
|
||||
}
|
||||
|
||||
C.vips_cache_set_max_mem(100 * 1024 * 1024)
|
||||
C.vips_cache_set_max(500)
|
||||
// Set libvips cache params
|
||||
C.vips_cache_set_max_mem(maxCacheMem)
|
||||
C.vips_cache_set_max(maxCacheSize)
|
||||
|
||||
// Explicit concurrency limit to avoid thread-unsafe issues.
|
||||
// See: https://github.com/jcupitt/libvips/issues/261#issuecomment-92850414
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue