Commit Graph

245 Commits

Author SHA1 Message Date
6cfbec4823 Add struct + functions for parsing hishtory versions 2023-09-23 11:23:47 -07:00
eb85f9a293 Revert "Remove TODO: I think this isn't worth implementing since in the long term, clients will update and this branch will not be necessary (and thus will primarily be tech debt)"
This reverts commit bbfda0be96.
2023-09-22 21:20:53 -07:00
bbfda0be96 Remove TODO: I think this isn't worth implementing since in the long term, clients will update and this branch will not be necessary (and thus will primarily be tech debt) 2023-09-22 19:20:51 -07:00
5bdbd9b262 Revert increased read_count requirement for deletion requests since deleting via encrypted-ID should be reliable 2023-09-22 19:19:06 -07:00
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
8c6443ed07 Fix incorrect column name 2023-09-22 18:59:37 -07:00
1d878195b2 Rework ff98a7907c to use the newly added EntryId column rather than deleting based on the start time 2023-09-22 14:03:41 -07:00
9b847c5e35 Further optimize client-server roundtrips by including deletion and dump requests in submit responses (follow up to 1e43de689f) 2023-09-22 13:49:29 -07:00
2a5a6d65c4 Roll-forward "Add preliminary support for persisting pre-saved history entries remotely"
This rolls-forward commit 66916c27cb.
2023-09-22 13:13:46 -07:00
66916c27cb Revert "Add preliminary support for persisting pre-saved history entries remotely"
This reverts commit ff98a7907c. That commit is incomplete since it doesn't include support for the continous deletion of pre-saved history entries as soon as they
finish running. Support for this will require a good bit more work/thought, so reverting for and keeping this code in the git history.
2023-09-21 12:39:20 -07:00
ff98a7907c Add preliminary support for persisting pre-saved history entries remotely 2023-09-21 12:39:04 -07:00
a3b865fa6b Move all handlers into either api_handlers.go for client-exposed handlers, or debug_handlers.go for debug/admin functionality 2023-09-21 11:47:16 -07:00
9fc1140ab9 Swap json decoding to Decoder API for shorter/clearer code 2023-09-21 11:42:02 -07:00
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
f64362fbba Fix metrics tag format so handler tags are properly exported to datadog 2023-09-17 22:46:31 -07:00
1ab61f1d7d Fix missing err != nil branch 2023-09-17 13:07:38 -07:00
d94e1bfa22 Fix imports after moving backend/server code in 772aaf2453 2023-09-17 12:53:55 -07:00
772aaf2453 Move internal/ directory into backend/server since it is all server-specific internals 2023-09-17 12:51:21 -07:00
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
b733878878 Skip re-initializing tables when running in prod to make server startup faster 2023-09-15 17:51:14 -07:00
63741a0d14 Optimize docker build efficiency by running apk add early so that it is cached 2023-09-15 17:10:55 -07:00
1036e14c17 Add debug prints to debug server startup 2023-09-15 17:07:25 -07:00
a66ea1387d Refactor server.go to remove two global variables 2023-09-13 21:47:06 -07:00
a8360efa67 revert main.ReleaseVersion changes 2023-09-12 15:55:41 -04:00
0d30011a33 break down release versions and fix server tests 2023-09-12 15:44:03 -04:00
60a0e20dd9 extract server object to its own package 2023-09-12 15:44:03 -04:00
02b1e8287d isolate all server handlers into a single struct, without using global variables 2023-09-12 15:44:01 -04:00
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
eaa837d17d fix check for empty array result (II) 2023-09-11 16:37:55 -04:00
ff2ac2194d fix %w 2023-09-11 13:03:29 -04:00
f9ee8ed189 use DateOnly as local constant instead of using the imported time package 2023-09-11 10:15:42 -04:00
3c18f62d99 finishing removing direct DB instructions from http handlers 2023-09-08 10:58:01 -04:00
0d6aa081d8 remove direct db instructions from apiRegisterHandler and statsHandler 2023-09-08 10:58:01 -04:00
382f234c09 remove usage_data related queries from the main package into a database package 2023-09-08 10:58:01 -04:00
a3e6d5a940 docker improvements:
* use alpine for small docker images
* use docker compose to wait for the database to be ready
* use a single Dockerfile with parameters to determine the correct GOARCH
* update makefile to account for the new GOARCH parameter on the Dockerfile
* remove native-arch-Dockerfile
2023-09-07 11:06:32 -04:00
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
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
e6d922709d fix tests 2023-09-07 09:50:36 -04:00
37670230af Merge remote-tracking branch 'origin/master' into sergio/handlers 2023-09-07 09:33:42 -04:00
589b99e500 do not use http.StatusNoContent 2023-09-07 08:34:21 -04:00
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
83ad8c7b1f wrap errors with %w instead of using %v 2023-09-05 15:08:55 -04:00
f1aefdbf30 Fix download URL for arm7 2023-02-18 22:29:01 -08:00
27cd544524 Add support for arm7 for #63 to support raspberry pis 2023-02-18 22:00:39 -08:00
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
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
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
7c86b812bf Add support for linux arm64 for #48 2022-12-11 20:39:45 -08:00
857e423e10 Fix linter errors + some general clean up 2022-12-11 20:31:50 -08:00
9ed325e0a5 Add support for limiting the number of registrations to fix #46 2022-12-11 19:42:51 -08:00