Files
knowledge-governance/cmd/worker/library_attempt_timing_drill.go
T
姚章浩 8d838d9cb4
build / build (push) Successful in 1m45s
feat(library): 整库发布身份、写集合与收尾边界
执行时真实时钟与持久授权回读(撤销/过期即停并保留预备份)、写集合写前落盘、
租约与 attempt 身份、恢复队列与原发送身份分离、成功收尾必须释放维护后再登记终态。
2026-11-01 11:35:10 +08:00

27 lines
747 B
Go

//go:build kg_isolated_drill
package main
import (
"net/url"
"os"
"strings"
"time"
)
// Only an explicitly tagged executable can shorten the real lease clock. It
// refuses non-disposable DBs; no production binary recognizes this injection.
const libraryAttemptLease = 4 * time.Second
func init() {
if os.Getenv("KG_LIBRARY_TEST_ISOLATED") != "1" {
panic("isolated drill build requires explicit opt-in")
}
for _, name := range []string{"DATABASE_URL", "LIBRARY_PRODUCTION_DATABASE_URL"} {
u, e := url.Parse(os.Getenv(name))
if e != nil || (u.Hostname() != "127.0.0.1" && u.Hostname() != "localhost") || !strings.HasPrefix(u.Path, "/kg_library_test_r8_") {
panic("isolated drill build refuses non-disposable database")
}
}
}