no need for FreeList, we have sync.Pool at home

This commit is contained in:
2026-02-20 15:01:45 -07:00
parent d2e6396ca7
commit d8eeeb7140
3 changed files with 6 additions and 72 deletions
+3 -2
View File
@@ -18,6 +18,7 @@ import (
"net/http"
"net/url"
"strconv"
"sync"
"time"
"git.erbosoft.com/amy/amsterdam/config"
@@ -510,7 +511,7 @@ var defoptions *AmSessionOptions = &AmSessionOptions{
}
// freeContext is a free list for amContext structures.
var freeContext util.FreeList[amContext]
var freeContext sync.Pool
// amContextRecycleBin is the channel we put contexts on to be recycled.
var amContextRecycleBin chan *amContext
@@ -523,7 +524,7 @@ var amContextRecycleBin chan *amContext
* Standard Go error status.
*/
func newContext(ctxt echo.Context) (*amContext, error) {
rc := freeContext.Get()
rc := freeContext.Get().(*amContext)
if rc == nil {
rc = &amContext{
rendervars: make(jet.VarMap),