Commit Graph

9 Commits

Author SHA1 Message Date
Cytown f1cb7cc8f5 fix gateway reload will cause pico stop working issue (#2082)
* fix gateway reload will cause pico stop working issue

* fix for review
2026-03-28 11:30:31 +08:00
perhapzz 2a28198d0f fix: check json.Decode errors and use errors.New instead of fmt.Errorf 2026-03-20 10:48:04 +00:00
perhapzz 0276554d9c test(fileutil,health): add unit tests for WriteFileAtomic and health server
Add comprehensive test coverage for two previously untested packages:

pkg/fileutil (9 tests):
- Basic write and read-back
- File permissions (0600)
- Overwrite existing files
- Empty data handling
- Nested directory auto-creation
- No temp files left after success
- Large file (1MB) handling
- Concurrent write safety
- Invalid path error handling

pkg/health (15 tests):
- Health endpoint returns 200 with status, uptime, pid
- Ready endpoint returns 503 when not ready
- Ready endpoint returns 200 when ready
- Ready fails when any registered check fails
- Ready passes with all checks passing
- Reload rejects non-POST methods
- Reload returns 503 when no reload func set
- Reload calls registered function on success
- Reload returns 500 on function error
- SetReady toggle behavior
- Multiple health checks interaction
- RegisterOnMux works with custom ServeMux
- NewServer defaults
- StartContext graceful shutdown on cancel
- statusString helper
2026-03-20 10:41:08 +00:00
Cytown 2a6ade0fe4 feat: add /reload to gateway api and command (#1725)
* feat: add /reload to gateway api and command

* prevent duplicate reload request in same time
2026-03-19 13:42:36 +08:00
Cytown be4a33cc15 refactor gateway/helpers and add server.pid to health (#1646) 2026-03-17 09:35:52 +08:00
Petrichor 62bdece7f5 chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
Petrichor 222d1a3086 refactor(modernize): apply safe modernize fixes 2026-02-27 16:35:07 +08:00
Hoshina 65a09208c4 refactor(channels): consolidate HTTP servers into shared server managed by Manager
Merge 3 independent channel HTTP servers (LINE :18791, WeCom Bot :18793,
WeCom App :18792) and the health server (:18790) into a single shared
HTTP server on the Gateway address. Channels implement WebhookHandler
and/or HealthChecker interfaces to register their handlers on the shared
mux. Also change Gateway default host from 0.0.0.0 to 127.0.0.1 for
security.
2026-02-23 02:39:09 +08:00
fahadahmadansari111 341dbd3007 Add health check endpoints (/health and /ready) for container orchestration liveness and readiness probes. (#104)
* added health endpoint

* formatted files

---------

Co-authored-by: lxowalle <83055338+lxowalle@users.noreply.github.com>
2026-02-16 11:53:11 +08:00