Commit d3935a73 authored by Jacob Priddy's avatar Jacob Priddy 👌

fix slow response times from api

- move to 2048 bit keys
- include webserver root cert in repo
- contact api every 60 seconds by default
- retry failed http connections if the connection broke
parent 9ed95475
Pipeline #12720 passed with stages
in 1 minute and 24 seconds
......@@ -21,7 +21,7 @@ build_tests:
build_esp32_application:
stage: build
script:
- echo $WEBSERVER_ROOT_CERT | base64 -d -w 0 > main/doorcode_root_cert.cert
- mv main/doorcode_root_cert.cert.prod main/doorcode_root_cert.cert
- cp main/include/config.h.example main/include/config.h
- /opt/esp/entrypoint.sh bash
- idf.py build
......
-----BEGIN CERTIFICATE-----
MIIB6jCCAZECFDb5sh03iLzvv3lh9hGvPShVD+XxMAoGCCqGSM49BAMCMHcxCzAJ
BgNVBAYTAlVTMRMwEQYDVQQIDApXYXNoaW5ndG9uMRYwFAYDVQQHDA1Db2xsZWdl
IFBsYWNlMQwwCgYDVQQKDANXV1UxHTAbBgNVBAsMFGVsb2NrIFJPT1QgQ0EgSVNT
VUVSMQ4wDAYDVQQDDAVlbG9jazAgFw0yMDA2MjcyMzIyNTFaGA8yMDcwMDYxNTIz
MjI1MVowdzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xFjAUBgNV
BAcMDUNvbGxlZ2UgUGxhY2UxDDAKBgNVBAoMA1dXVTEdMBsGA1UECwwUZWxvY2sg
Uk9PVCBDQSBJU1NVRVIxDjAMBgNVBAMMBWVsb2NrMFkwEwYHKoZIzj0CAQYIKoZI
zj0DAQcDQgAEAhPkFYRa4nWox26JCB8ClUg/PORZvkkzGMV4/yKZNWPSRtqS8QKD
09dRt55MVj5W4AmRkRHwqbXTAvujt7eovzAKBggqhkjOPQQDAgNHADBEAiBjDRHN
wmkwISOF2AE3cAgyMiUlXPA+WAZKHgbxKX1MUwIgdW47WeuGJ53939yX1vOiYDky
GLh8/I3sv/uEnA0TIFI=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDlTCCAn0CFFXlCyR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fGYdmKq/tYbULjdYtysrigl
IZFQrM+oXpKEDKq+Fqax27O9RrgmIIrxpAU0/KxASbKgpCkW+T2UZTjOjms8NpdO
EH7zjGq59lewpAyG5trG/OAVzmi4sIKiRwXQwdHjcGXwjio+isDbu0s2HI5nCZSh
MlKGC4g2E4bP
-----END CERTIFICATE-----
......@@ -48,8 +48,10 @@
#define MIN_CODE_LENGTH 4
// 15 minutes
#define STATUS_MAX_NO_CONTACT_TIME_MS (1000 * 60 * 15)
// Set to 1 minute instead of something like 15 minutes to keep the SSL connection alive
// so it can be reused as much as possible, as it takes around 2 seconds with RSA 2048 keys
// and a whopping 5 seconds with ECDSA keys :(
#define STATUS_MAX_NO_CONTACT_TIME_MS (1000 * 60)
// How often to update the keypad state
#define KEYPAD_SCAN_PERIOD_MS 50
......
......@@ -168,7 +168,7 @@ int door_http_get(door_http_client_handle_t client, const char* path, door_http_
// Bug in the framework, have to retry until it works
// https://github.com/espressif/esp-idf/issues/2684
for (int tries = 0; tries < 5; ++tries) {
for (int tries = 0; tries < 3; ++tries) {
esp_err_t err = esp_http_client_perform(handle);
if (err == ESP_OK)
......@@ -206,7 +206,7 @@ int door_http_post(
// Bug in the framework, have to retry until it works
// https://github.com/espressif/esp-idf/issues/2684
for (int tries = 0; tries < 5; ++tries) {
for (int tries = 0; tries < 3; ++tries) {
esp_err_t err = esp_http_client_perform(handle);
if (err == ESP_OK)
......
This diff is collapsed.
1.0.2.1
\ No newline at end of file
1.0.3.0
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment