Compare commits

...

10 Commits

Author SHA1 Message Date
Eric Coissac 960ad1531d [4.4.34] HTTP client thread-safety and CI infrastructure updates
- Improved concurrency safety by replacing the global HTTP client with a thread-safe, lazy-initialized instance using `sync.Once`. The new implementation enables connection pooling (`MaxIdleConnsPerHost`, connections per host) and dynamically configures pool size based on `obidefault.ParallelWorkers()`, ensuring robust behavior in multi-threaded Lua environments.
- Updated GitHub Actions workflows to the latest stable versions of `actions/setup-go` and ` actions/checkout`, improving build reliability.
- Removed outdated Go dependency checksums for buger/jsonparser v1.1.x to keep the build clean and consistent.
2026-04-13 16:27:14 +02:00
Eric Coissac 137f49d1d1 🔧 refactor(http): use thread-safe lazy-initialized HTTP client with connection pooling
- Replace global _httpClient variable by a sync.Once-based lazy initialization
- Add getHTTPClient() function to safely initialize client with connection pooling settings (MaxIdleConnsPerHost, Max Con ns/Conn per host)
- Set connection pool size based on obidefault.ParallelWorkers()

This ensures safe concurrent access and better resource management in multi-threaded Lua environments.
2026-04-13 16:27:09 +02:00
Eric Coissac 083a92e13d ⬆️ update GitHub Actions to latest versions
- Upgrade actions/setup-go from v2/v4 (depending on workflow) to latest stable version
- Update all actions/checkout from v3/v4 (depending on workflow) to latest stable version
- Clean up outdated go.sum entries for buger/jsonparser v1.1.x
2026-04-13 14:41:47 +02:00
coissac 67683435e8 Merge pull request #107 from metabarcoding/push-oyzynqqnturm
Push oyzynqqnturm
2026-04-13 14:29:44 +02:00
Eric Coissac f32b29db4f Release 4.4.33 2026-04-13 14:29:18 +02:00
Eric Coissac 10f49fe64b 📝 Clarify RegisterHTTP global registration intent
//
// Registers the http module in Lua state as a global,
// aligning with obicontext and BioSequence conventions.
The change ensures consistent module exposure across Lua environments.
2026-04-13 14:29:16 +02:00
coissac d257917748 Merge pull request #106 from metabarcoding/push-qoqotlnktvls
Push qoqotlnktvls
2026-04-13 14:08:42 +02:00
Eric Coissac fec078c04c Release 4.4.32 2026-04-13 14:08:16 +02:00
Eric Coissac a92393dd51 ⬆️ update go.mod dependencies and improve error messages
- Bump github.com/buger/jsonparser from v1.1.1 to v1.2
- Add error details in log.Fatalf calls for better debugging
2026-04-13 14:08:13 +02:00
coissac 7e76698490 Merge pull request #105 from metabarcoding/push-pnqoquxmpqpq
Push pnqoquxmpqpq
2026-04-13 13:36:13 +02:00
8 changed files with 36 additions and 17 deletions
+2 -2
View File
@@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Checkout obitools4 project
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run tests
run: make githubtests
+3 -3
View File
@@ -18,7 +18,7 @@ jobs:
with:
go-version: "1.26"
- name: Checkout obitools4 project
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run tests
run: make githubtests
@@ -49,7 +49,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v5
@@ -107,7 +107,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
+1 -1
View File
@@ -6,7 +6,7 @@ require (
github.com/DavidGamba/go-getoptions v0.33.0
github.com/PaesslerAG/gval v1.2.4
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df
github.com/buger/jsonparser v1.1.1
github.com/buger/jsonparser v1.1.2
github.com/chen3feng/stl4go v0.1.1
github.com/dlclark/regexp2 v1.11.5
github.com/goccy/go-json v0.10.6
+2 -2
View File
@@ -6,8 +6,8 @@ github.com/PaesslerAG/jsonpath v0.1.0 h1:gADYeifvlqK3R3i2cR5B4DGgxLXIPb3TRTH1mGi
github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8=
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/buger/jsonparser v1.1.2 h1:frqHqw7otoVbk5M8LlE/L7HTnIq2v9RX6EJ48i9AxJk=
github.com/buger/jsonparser v1.1.2/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/chen3feng/stl4go v0.1.1 h1:0L1+mDw7pomftKDruM23f1mA7miavOj6C6MZeadzN2Q=
github.com/chen3feng/stl4go v0.1.1/go.mod h1:5ml3psLgETJjRJnMbPE+JiHLrCpt+Ajc2weeTECXzWU=
github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=
+3 -3
View File
@@ -91,7 +91,7 @@ func LuaWorker(proto *lua.FunctionProto) obiseq.SeqWorker {
err := interpreter.PCall(0, lua.MultRet, nil)
if err != nil {
log.Fatalf("Error in executing the lua script")
log.Fatalf("Error in executing the lua script: %v", err)
}
result := interpreter.GetGlobal("worker")
@@ -173,7 +173,7 @@ func LuaProcessor(iterator obiiter.IBioSequence, name, program string, breakOnEr
err = interpreter.PCall(0, lua.MultRet, nil)
if err != nil {
log.Fatalf("Error in executing the lua script")
log.Fatalf("Error in executing the lua script: %v", err)
}
result := interpreter.GetGlobal("begin")
@@ -198,7 +198,7 @@ func LuaProcessor(iterator obiiter.IBioSequence, name, program string, breakOnEr
err = interpreter.PCall(0, lua.MultRet, nil)
if err != nil {
log.Fatalf("Error in executing the lua script")
log.Fatalf("Error in executing the lua script: %v", err)
}
result := interpreter.GetGlobal("finish")
+23 -4
View File
@@ -4,18 +4,37 @@ import (
"io"
"net/http"
"strings"
"sync"
"time"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
lua "github.com/yuin/gopher-lua"
)
const httpClientTimeout = 30 * time.Second
var _httpClient = &http.Client{
Timeout: httpClientTimeout,
var (
_httpClient *http.Client
_httpClientOnce sync.Once
)
func getHTTPClient() *http.Client {
_httpClientOnce.Do(func() {
conns := 2 * obidefault.ParallelWorkers()
_httpClient = &http.Client{
Transport: &http.Transport{
MaxIdleConnsPerHost: conns,
MaxConnsPerHost: conns,
IdleConnTimeout: 90 * time.Second,
},
Timeout: httpClientTimeout,
}
})
return _httpClient
}
// RegisterHTTP registers the http module in the Lua state.
// RegisterHTTP registers the http module in the Lua state as a global,
// consistent with obicontext and BioSequence.
//
// Exposes:
//
@@ -45,7 +64,7 @@ func luaHTTPPost(L *lua.LState) int {
}
req.Header.Set("Content-Type", "application/json")
resp, err := _httpClient.Do(req)
resp, err := getHTTPClient().Do(req)
if err != nil {
L.Push(lua.LNil)
L.Push(lua.LString(err.Error()))
+1 -1
View File
@@ -3,7 +3,7 @@ package obioptions
// Version is automatically updated by the Makefile from version.txt
// The patch number (third digit) is incremented on each push to the repository
var _Version = "Release 4.4.31"
var _Version = "Release 4.4.34"
// Version returns the version of the obitools package.
//
+1 -1
View File
@@ -1 +1 @@
4.4.31
4.4.34