Commit Graph

126 Commits

Author SHA1 Message Date
Richard James
9ac3df1bbb
Allow override of serving port by env var (#160)
Can now set HISHTORY_SERVER_PORT but will default to 8080.
2023-12-23 17:22:26 -08:00
David Dworken
3a01e47701
Refactor: Move UsageData and Device to the backend/server directory since they are purely server-side constructs 2023-12-10 10:32:04 -08:00
David Dworken
b4f5f50ef7
Configure custom logger when running hishtory server with sqlite 2023-11-22 20:44:24 -08:00
David Dworken
1c68b23790
Change panic to error so that one cron failure doesn't kill all cron jobs 2023-11-22 20:43:40 -08:00
David Dworken
29fa710fbc
Skip creating DB indexes in the production environment since we manually create those concurrently 2023-11-12 03:21:01 -08:00
David Dworken
56e4609970
Make server.go's cron more precise about how it periodically re-runs more intensive cron functions 2023-11-01 18:06:16 -07:00
David Dworken
9a4a2a18aa
Update TODOs 2023-10-15 17:59:11 -07:00
David Dworken
505daacb65
Add another TODO for cleaning up integration tests from the main DB 2023-10-15 14:54:01 -07:00
David Dworken
0b57034c39
Revert "Revert all commits since v0.223 to enable me to release a patch on top of v0.223"
This reverts commit 68ed9f2d5d.
2023-09-29 18:21:23 -07:00
David Dworken
68ed9f2d5d
Revert all commits since v0.223 to enable me to release a patch on top of v0.223 2023-09-28 22:15:30 -07:00
David Dworken
96e8e4f620
Add backend table to track daily/weekly active user stats 2023-09-28 22:14:55 -07:00
David Dworken
6d5a86a8bb
Revert all commits since v0.223 to enable me to release a patch on top of v0.223 2023-09-28 21:49:37 -07:00
David Dworken
db4e31d997
Add backend table to track daily/weekly active user stats 2023-09-26 20:11:06 -07:00
David Dworken
1a144e4e70
Call TrackUsageData(true) to enable usage data tracking, which was accidentally disabled during server refactoring 2023-09-24 14:17:15 -07:00
David Dworken
cc11916f3c
Create func to automatically create DB indexes rather than just documenting them in a comment that has to be manually executed 2023-09-22 19:11:43 -07:00
David Dworken
1e43de689f
Optimize number of round-trip HTTP connections made by the client by having the submit handler return metadata about whether there are pending dump/deletion requests
For now, I'm still keeping the dedicated endpoints for those functionalities, but since most of the time there are no dump/deletion requests this should cut down the number of requests made by the client by 2/3.
2023-09-21 11:35:24 -07:00
David Dworken
d94e1bfa22
Fix imports after moving backend/server code in 772aaf2453 2023-09-17 12:53:55 -07:00
David Dworken
04a0fc40cd
Make errors from updateUsageData(...) crash when running in non-prod to ensure they're detected/handled before deployment 2023-09-17 12:03:42 -07:00
David Dworken
b733878878
Skip re-initializing tables when running in prod to make server startup faster 2023-09-15 17:51:14 -07:00
David Dworken
1036e14c17
Add debug prints to debug server startup 2023-09-15 17:07:25 -07:00
David Dworken
a66ea1387d
Refactor server.go to remove two global variables 2023-09-13 21:47:06 -07:00
Sergio Moura
a8360efa67 revert main.ReleaseVersion changes 2023-09-12 15:55:41 -04:00
Sergio Moura
0d30011a33 break down release versions and fix server tests 2023-09-12 15:44:03 -04:00
Sergio Moura
60a0e20dd9 extract server object to its own package 2023-09-12 15:44:03 -04:00
Sergio Moura
02b1e8287d isolate all server handlers into a single struct, without using global variables 2023-09-12 15:44:01 -04:00
David Dworken
50c74e5881
Rename a bunch of DB functions + add error checking for DB table creation (follow up to #104) 2023-09-12 08:30:43 -07:00
Sergio Moura
ff2ac2194d fix %w 2023-09-11 13:03:29 -04:00
Sergio Moura
f9ee8ed189 use DateOnly as local constant instead of using the imported time package 2023-09-11 10:15:42 -04:00
Sergio Moura
3c18f62d99 finishing removing direct DB instructions from http handlers 2023-09-08 10:58:01 -04:00
Sergio Moura
0d6aa081d8 remove direct db instructions from apiRegisterHandler and statsHandler 2023-09-08 10:58:01 -04:00
Sergio Moura
382f234c09 remove usage_data related queries from the main package into a database package 2023-09-08 10:58:01 -04:00
David Dworken
aa3c7fc41a
Follow up to #103: assign err from fmt.Fprintf to _ to ensure go-errcheck doesn't flag it 2023-09-07 07:57:20 -07:00
David Dworken
68e3a813c9
Follow up to #103: pull context from r.Context() when used rather than at the start of functions 2023-09-07 07:56:03 -07:00
Sergio Moura
37670230af Merge remote-tracking branch 'origin/master' into sergio/handlers 2023-09-07 09:33:42 -04:00
Sergio Moura
589b99e500 do not use http.StatusNoContent 2023-09-07 08:34:21 -04:00
Sergio Moura
2b1ba7e3ba use single context and always return a status to the client
api handlers do not need an extra context. http.Request already has a context that is being ignored, so we leverage it and stop creating a new one.
make the endpoints return http.StatusNoContent instead of just closing the connection from the client.
2023-09-06 11:37:14 -04:00
Sergio Moura
83ad8c7b1f wrap errors with %w instead of using %v 2023-09-05 15:08:55 -04:00
David Dworken
f1aefdbf30
Fix download URL for arm7 2023-02-18 22:29:01 -08:00
David Dworken
27cd544524
Add support for arm7 for #63 to support raspberry pis 2023-02-18 22:00:39 -08:00
David Dworken
8dc5168c64
Set max open conns to 1 for test code to fix race conditions that lead to flaky tests 2023-02-13 20:50:33 -08:00
David Dworken
f502cbee1d
Fix memory leak caused by not closing resp.Body (#62) and also fix the server to work when the DD integration is disabled 2022-12-23 17:17:44 -08:00
David Dworken
06a4bf0bcb
Add code to deep clean the DB to remove entries from people with 1 device that haven't been active in at least 90 days 2022-12-17 21:27:00 -08:00
David Dworken
7c86b812bf
Add support for linux arm64 for #48 2022-12-11 20:39:45 -08:00
David Dworken
857e423e10
Fix linter errors + some general clean up 2022-12-11 20:31:50 -08:00
David Dworken
9ed325e0a5
Add support for limiting the number of registrations to fix #46 2022-12-11 19:42:51 -08:00
David Dworken
35444bf56e
Swap ioutil to non-deprecated alternatives + clean up pre-commit errors 2022-11-27 11:59:06 -08:00
David Dworken
22330f3ee1
Ensure that tests assert a lack of leaked connections 2022-11-26 22:40:43 -08:00
David Dworken
f77eb38618
Rename misleading var 2022-11-26 22:16:11 -08:00
David Dworken
2ba535b650
Call Close() on sql.Rows to prevent connection leak 2022-11-26 22:15:16 -08:00
David Dworken
4e84f49de9
Revert "Move usage data into tx to optimize updating usage data"
This reverts commit aa501262e6.
2022-11-26 18:59:32 -08:00