mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-27 01:32:51 +08:00
This commit is contained in:
1 parent
423379a38e
commit
a622842e9e
2 files changed
+12
-4
No files matched your search
@@ -12,7 +12,7 @@ LUCI_DEPENDS:=+luci-base +logd +jsonfilter
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=0.1.45
|
||||
PKG_RELEASE:=36
|
||||
PKG_RELEASE:=37
|
||||
|
||||
# Reproducible build: honor SOURCE_DATE_EPOCH from the build environment (set by docker-sdk.sh / CI).
|
||||
ifdef SOURCE_DATE_EPOCH
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
# Hot-path budget: ≤1 flock exec per update (release by closing the fd when the
|
||||
# subshell exits — no flock -u). /proc/uptime + state I/O via shell builtins/
|
||||
# redirects (no sed/cat/jsonfilter on the adaptive path). Fail-open on missing
|
||||
# flock, lock busy, or corrupt state. Lock-busy ⇒ unlocked last-writer-wins is
|
||||
# acceptable (state stays one valid JSON line; ordering is not guaranteed).
|
||||
# flock, lock busy, or corrupt state. Fail-closed if the lock file cannot be
|
||||
# opened (skip the write; do not record unlocked). Lock-busy ⇒ unlocked
|
||||
# last-writer-wins is acceptable (state stays one valid JSON line; ordering
|
||||
# is not guaranteed).
|
||||
# Failed ubus log.read must NOT call record() — a ~0 ms failure is not "cold"
|
||||
# health and must not clear an existing hot/shed cap.
|
||||
# Outside the measured duration interval: plan (pre), record/merge (post).
|
||||
@@ -225,7 +227,8 @@ fwlive_adaptive_write_state() {
|
||||
# missing/busy. Release by exiting the subshell (closes fd 9) — no flock -u.
|
||||
# Busy ⇒ run unlocked: last-writer-wins is acceptable (valid one-line JSON;
|
||||
# ordering under contention is not guaranteed).
|
||||
# Lock-open failure (redirection) also fail-opens unlocked so record() still runs.
|
||||
# Lock-open failure (redirection): fail-closed — skip the write; do not run
|
||||
# record() unlocked. Probe fd 9 first so a set -eu caller does not abort.
|
||||
fwlive_adaptive_with_lock() {
|
||||
if ! command -v flock >/dev/null 2>&1; then
|
||||
"$@"
|
||||
@@ -251,6 +254,11 @@ fwlive_adaptive_with_lock() {
|
||||
"$@"
|
||||
return $?
|
||||
fi
|
||||
# Probe in a subshell first: a failed fd-9 redirection aborts a POSIX
|
||||
# non-interactive shell (set -eu) before any fallback can run.
|
||||
if ! ( exec 9>>"$_lock" ) 2>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
(
|
||||
if flock -n 9; then
|
||||
"$@"
|
||||
|
||||
Reference in new issue
Block a user