diff --git a/server/.sqlx/query-49fbabe461c8a8276b9f929b40703b12804d37d375e89d495ad4aab56d058d8e.json b/server/.sqlx/query-49fbabe461c8a8276b9f929b40703b12804d37d375e89d495ad4aab56d058d8e.json new file mode 100644 index 000000000..c24aa9df6 --- /dev/null +++ b/server/.sqlx/query-49fbabe461c8a8276b9f929b40703b12804d37d375e89d495ad4aab56d058d8e.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM calendar WHERE NOT EXISTS (SELECT * FROM UNNEST($1::text[]) AS expected(key) WHERE calendar.room_code = expected.key)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "TextArray" + ] + }, + "nullable": [] + }, + "hash": "49fbabe461c8a8276b9f929b40703b12804d37d375e89d495ad4aab56d058d8e" +} diff --git a/server/.sqlx/query-52238d1fce52636ffea211bcade564ded24c6e57ac18568ca4291353a695e60d.json b/server/.sqlx/query-52238d1fce52636ffea211bcade564ded24c6e57ac18568ca4291353a695e60d.json new file mode 100644 index 000000000..f3d67ef4e --- /dev/null +++ b/server/.sqlx/query-52238d1fce52636ffea211bcade564ded24c6e57ac18568ca4291353a695e60d.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT COUNT(*) FROM de", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "count", + "type_info": "Int8" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "52238d1fce52636ffea211bcade564ded24c6e57ac18568ca4291353a695e60d" +} diff --git a/server/Cargo.lock b/server/Cargo.lock index 670b97033..a55568d5a 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -320,55 +320,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "anstyle-parse" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "anyhow" version = "1.0.86" @@ -769,12 +720,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" -[[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - [[package]] name = "conquer-once" version = "0.4.0" @@ -975,6 +920,16 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + [[package]] name = "der" version = "0.7.9" @@ -1104,45 +1059,12 @@ dependencies = [ "syn 2.0.68", ] -[[package]] -name = "env_filter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "humantime", - "log", -] - [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "erased-serde" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" -dependencies = [ - "serde", - "typeid", -] - [[package]] name = "errno" version = "0.3.9" @@ -1201,6 +1123,18 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "findshlibs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" +dependencies = [ + "cc", + "lazy_static", + "libc", + "winapi", +] + [[package]] name = "flate2" version = "1.0.30" @@ -1228,6 +1162,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1604,6 +1553,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "hostname" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba" +dependencies = [ + "cfg-if", + "libc", + "windows", +] + [[package]] name = "http" version = "0.2.12" @@ -1672,12 +1632,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "0.14.29" @@ -1790,6 +1744,22 @@ dependencies = [ "webpki-roots 0.26.3", ] +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.3.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + [[package]] name = "hyper-util" version = "0.1.5" @@ -1991,12 +1961,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is_terminal_polyfill" -version = "1.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" - [[package]] name = "iso8601" version = "0.6.1" @@ -2169,10 +2133,6 @@ name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -dependencies = [ - "serde", - "value-bag", -] [[package]] name = "logos" @@ -2194,7 +2154,7 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "regex-syntax", + "regex-syntax 0.8.4", "syn 2.0.68", ] @@ -2231,6 +2191,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matrixmultiply" version = "0.3.8" @@ -2356,6 +2325,23 @@ dependencies = [ "typenum", ] +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "navigatum-main-api" version = "1.0.0" @@ -2368,13 +2354,11 @@ dependencies = [ "base64 0.22.1", "cached", "chrono", - "env_logger", "futures", "image", "imageproc", "jsonwebtoken", "lazy_static", - "log", "logos", "meilisearch-sdk", "oauth2", @@ -2384,16 +2368,19 @@ dependencies = [ "regex", "reqwest 0.12.5", "rustls 0.23.10", + "sentry", + "sentry-actix", "serde", "serde_json", "serde_yaml", "sqlx", - "structured-logger", "tempfile", "testcontainers", "testcontainers-modules", "time", "tokio", + "tracing", + "tracing-subscriber", "unicode-truncate", ] @@ -2431,6 +2418,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num" version = "0.4.3" @@ -2620,18 +2617,73 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "option-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "os_info" +version = "3.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae99c7fa6dd38c7cafe1ec085e804f8f555a2f8659b0dbe03f1f9963a9b51092" +dependencies = [ + "log", + "serde", + "windows-sys 0.52.0", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "owned_ttf_parser" version = "0.21.0" @@ -2697,7 +2749,7 @@ checksum = "914a1c2265c98e2446911282c6ac86d8524f495792c38c5bd884f80499c7538a" dependencies = [ "parse-display-derive", "regex", - "regex-syntax", + "regex-syntax 0.8.4", ] [[package]] @@ -2709,7 +2761,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "regex-syntax", + "regex-syntax 0.8.4", "structmeta", "syn 2.0.68", ] @@ -3150,8 +3202,17 @@ checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -3162,7 +3223,7 @@ checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.4", ] [[package]] @@ -3171,6 +3232,12 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.4" @@ -3228,6 +3295,7 @@ dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", + "futures-channel", "futures-core", "futures-util", "h2 0.4.5", @@ -3237,11 +3305,13 @@ dependencies = [ "http-body-util", "hyper 1.3.1", "hyper-rustls 0.27.2", + "hyper-tls", "hyper-util", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -3255,6 +3325,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper 1.0.1", "tokio", + "tokio-native-tls", "tokio-rustls 0.26.0", "tokio-util", "tower-service", @@ -3273,7 +3344,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ - "hostname", + "hostname 0.3.1", "quick-error 1.2.3", ] @@ -3554,6 +3625,127 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "sentry" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5484316556650182f03b43d4c746ce0e3e48074a21e2f51244b648b6542e1066" +dependencies = [ + "httpdate", + "native-tls", + "reqwest 0.12.5", + "rustls 0.22.4", + "sentry-backtrace", + "sentry-contexts", + "sentry-core", + "sentry-debug-images", + "sentry-panic", + "sentry-tracing", + "tokio", + "ureq", + "webpki-roots 0.26.3", +] + +[[package]] +name = "sentry-actix" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e461c7d3a46d298b5ffc66127c1f16454dd11d3d89fcfb21023cd499d82b9a78" +dependencies = [ + "actix-web", + "futures-util", + "sentry-core", +] + +[[package]] +name = "sentry-backtrace" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40aa225bb41e2ec9d7c90886834367f560efc1af028f1c5478a6cce6a59c463a" +dependencies = [ + "backtrace", + "once_cell", + "regex", + "sentry-core", +] + +[[package]] +name = "sentry-contexts" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a8dd746da3d16cb8c39751619cefd4fcdbd6df9610f3310fd646b55f6e39910" +dependencies = [ + "hostname 0.4.0", + "libc", + "os_info", + "rustc_version", + "sentry-core", + "uname", +] + +[[package]] +name = "sentry-core" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "161283cfe8e99c8f6f236a402b9ccf726b201f365988b5bb637ebca0abbd4a30" +dependencies = [ + "once_cell", + "rand", + "sentry-types", + "serde", + "serde_json", +] + +[[package]] +name = "sentry-debug-images" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc6b25e945fcaa5e97c43faee0267eebda9f18d4b09a251775d8fef1086238a" +dependencies = [ + "findshlibs", + "once_cell", + "sentry-core", +] + +[[package]] +name = "sentry-panic" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc74f229c7186dd971a9491ffcbe7883544aa064d1589bd30b83fb856cd22d63" +dependencies = [ + "sentry-backtrace", + "sentry-core", +] + +[[package]] +name = "sentry-tracing" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd3c5faf2103cd01eeda779ea439b68c4ee15adcdb16600836e97feafab362ec" +dependencies = [ + "sentry-backtrace", + "sentry-core", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sentry-types" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d68cdf6bc41b8ff3ae2a9c4671e97426dcdd154cc1d4b6b72813f285d6b163f" +dependencies = [ + "debugid", + "hex", + "rand", + "serde", + "serde_json", + "thiserror", + "time", + "url", + "uuid", +] + [[package]] name = "serde" version = "1.0.203" @@ -3574,15 +3766,6 @@ dependencies = [ "syn 2.0.68", ] -[[package]] -name = "serde_fmt" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d4ddca14104cd60529e8c7f7ba71a2c8acd8f7f5cfcdc2faf97eeb7c3010a4" -dependencies = [ - "serde", -] - [[package]] name = "serde_json" version = "1.0.119" @@ -3701,6 +3884,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook" version = "0.3.17" @@ -4117,103 +4309,12 @@ dependencies = [ "syn 2.0.68", ] -[[package]] -name = "structured-logger" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16524b1ef57fd2e253216ab20ec44f0dc32b29155a4b3e6bef0a857d8c9f5f08" -dependencies = [ - "log", - "parking_lot 0.12.3", - "serde", - "serde_json", - "tokio", -] - [[package]] name = "subtle" version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "sval" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53eb957fbc79a55306d5d25d87daf3627bc3800681491cda0709eef36c748bfe" - -[[package]] -name = "sval_buffer" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96e860aef60e9cbf37888d4953a13445abf523c534640d1f6174d310917c410d" -dependencies = [ - "sval", - "sval_ref", -] - -[[package]] -name = "sval_dynamic" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea3f2b07929a1127d204ed7cb3905049381708245727680e9139dac317ed556f" -dependencies = [ - "sval", -] - -[[package]] -name = "sval_fmt" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4e188677497de274a1367c4bda15bd2296de4070d91729aac8f0a09c1abf64d" -dependencies = [ - "itoa", - "ryu", - "sval", -] - -[[package]] -name = "sval_json" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f456c07dae652744781f2245d5e3b78e6a9ebad70790ac11eb15dbdbce5282" -dependencies = [ - "itoa", - "ryu", - "sval", -] - -[[package]] -name = "sval_nested" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "886feb24709f0476baaebbf9ac10671a50163caa7e439d7a7beb7f6d81d0a6fb" -dependencies = [ - "sval", - "sval_buffer", - "sval_ref", -] - -[[package]] -name = "sval_ref" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2e7fc517d778f44f8cb64140afa36010999565528d48985f55e64d45f369ce" -dependencies = [ - "sval", -] - -[[package]] -name = "sval_serde" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79bf66549a997ff35cd2114a27ac4b0c2843280f2cfa84b240d169ecaa0add46" -dependencies = [ - "serde", - "sval", - "sval_nested", -] - [[package]] name = "syn" version = "1.0.109" @@ -4359,6 +4460,16 @@ dependencies = [ "syn 2.0.68", ] +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "tiff" version = "0.9.1" @@ -4446,6 +4557,16 @@ dependencies = [ "syn 2.0.68", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.24.1" @@ -4612,6 +4733,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", ] [[package]] @@ -4626,18 +4790,21 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" -[[package]] -name = "typeid" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf" - [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "uname" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" +dependencies = [ + "libc", +] + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -4704,6 +4871,23 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" +dependencies = [ + "base64 0.22.1", + "log", + "native-tls", + "once_cell", + "rustls 0.22.4", + "rustls-pki-types", + "rustls-webpki 0.102.4", + "url", + "webpki-roots 0.26.3", +] + [[package]] name = "url" version = "2.5.2" @@ -4722,12 +4906,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "uuid" version = "1.9.1" @@ -4735,6 +4913,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" dependencies = [ "getrandom", + "serde", "wasm-bindgen", ] @@ -4750,40 +4929,10 @@ dependencies = [ ] [[package]] -name = "value-bag" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" -dependencies = [ - "value-bag-serde1", - "value-bag-sval2", -] - -[[package]] -name = "value-bag-serde1" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccacf50c5cb077a9abb723c5bcb5e0754c1a433f1e1de89edc328e2760b6328b" -dependencies = [ - "erased-serde", - "serde", - "serde_fmt", -] - -[[package]] -name = "value-bag-sval2" -version = "1.9.0" +name = "valuable" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1785bae486022dfb9703915d42287dcb284c1ee37bd1080eeba78cc04721285b" -dependencies = [ - "sval", - "sval_buffer", - "sval_dynamic", - "sval_fmt", - "sval_json", - "sval_ref", - "sval_serde", -] +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vcpkg" @@ -4982,6 +5131,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.5", +] + [[package]] name = "windows-core" version = "0.52.0" diff --git a/server/main-api/Cargo.toml b/server/main-api/Cargo.toml index 92b95634f..52205f6d1 100644 --- a/server/main-api/Cargo.toml +++ b/server/main-api/Cargo.toml @@ -16,10 +16,11 @@ path = "src/main.rs" [dependencies] # logging/obeservability -log = "0.4.21" actix-web-prom = { version = "0.8.0", default-features = false, features = [] } -env_logger = "0.11.3" # used in dev -structured-logger = "1.0.3" # used in prod +tracing-subscriber = { version = "0.3.18",features = ["env-filter", "json", "fmt"]} +tracing = "0.1.40" +sentry = { version = "0.34.0", features = ["backtrace","contexts","debug-images","panic","reqwest","rustls"] } +sentry-actix = "0.34.0" #serialisation serde = { version = "1.0.200", features = ["derive"] } @@ -67,7 +68,6 @@ actix-governor = { version = "0.5.0", features = ["logger"] } tempfile = "3.10.1" base64 = "0.22.1" time = "0.3.36" -testcontainers-modules = { version = "0.7.0", features = ["postgres"] } [dev-dependencies] pretty_assertions = "1.4.0" diff --git a/server/main-api/src/calendar/connectum.rs b/server/main-api/src/calendar/connectum.rs index f828d676d..46110b955 100644 --- a/server/main-api/src/calendar/connectum.rs +++ b/server/main-api/src/calendar/connectum.rs @@ -2,12 +2,12 @@ use std::time::{Duration, Instant}; use std::{env, io}; use chrono::{DateTime, Utc}; -use log::{debug, error, warn}; use oauth2::basic::{BasicClient, BasicTokenResponse}; use oauth2::reqwest::async_http_client; use oauth2::url::Url; use oauth2::{AuthUrl, ClientId, ClientSecret, Scope, TokenResponse, TokenUrl}; use sqlx::PgPool; +use tracing::{debug, error, warn}; use crate::calendar::models::Event; diff --git a/server/main-api/src/calendar/mod.rs b/server/main-api/src/calendar/mod.rs index 89db6fc9c..ef2e209dd 100644 --- a/server/main-api/src/calendar/mod.rs +++ b/server/main-api/src/calendar/mod.rs @@ -2,9 +2,9 @@ use std::collections::HashMap; use actix_web::{post, web, HttpResponse}; use chrono::{DateTime, Utc}; -use log::error; use serde::{Deserialize, Serialize}; use sqlx::PgPool; +use tracing::error; use crate::calendar::models::{CalendarLocation, Event, LocationEvents}; diff --git a/server/main-api/src/calendar/refresh.rs b/server/main-api/src/calendar/refresh.rs index d41f59644..25dbc2099 100644 --- a/server/main-api/src/calendar/refresh.rs +++ b/server/main-api/src/calendar/refresh.rs @@ -3,9 +3,9 @@ use std::time::Duration; use cached::instant::Instant; use futures::stream::FuturesUnordered; use futures::StreamExt; -use log::{debug, error}; use serde::{Deserialize, Serialize}; use sqlx::PgPool; +use tracing::{debug, error}; use crate::calendar::connectum::APIRequestor; @@ -64,7 +64,9 @@ LIMIT 30"#) // this uses a FuturesUnordered which refills itsself to be able to work effectively with lagging tasks let mut work_queue = FuturesUnordered::new(); for _ in 0..NUMBER_OF_CONCURRENT_SCRAPES { - work_queue.push(api.refresh(ids.pop().unwrap().key)); + if let Some(id) = ids.pop() { + work_queue.push(api.refresh(id.key)); + } } while let Some(res) = work_queue.next().await { diff --git a/server/main-api/src/details.rs b/server/main-api/src/details.rs index 2de81adfd..35efb2034 100644 --- a/server/main-api/src/details.rs +++ b/server/main-api/src/details.rs @@ -1,7 +1,7 @@ use actix_web::{get, web, HttpResponse}; -use log::error; use sqlx::Error::RowNotFound; use sqlx::PgPool; +use tracing::error; use crate::models::LocationKeyAlias; use crate::utils; diff --git a/server/main-api/src/feedback/github.rs b/server/main-api/src/feedback/github.rs index 6ddb73a89..df7df4835 100644 --- a/server/main-api/src/feedback/github.rs +++ b/server/main-api/src/feedback/github.rs @@ -1,7 +1,7 @@ use actix_web::HttpResponse; -use log::error; use octocrab::Octocrab; use regex::Regex; +use tracing::error; fn github_token() -> Result { match std::env::var("GITHUB_TOKEN") { diff --git a/server/main-api/src/feedback/proposed_edits/image.rs b/server/main-api/src/feedback/proposed_edits/image.rs index f4794861a..ceaf73e7e 100644 --- a/server/main-api/src/feedback/proposed_edits/image.rs +++ b/server/main-api/src/feedback/proposed_edits/image.rs @@ -5,9 +5,9 @@ use std::path::{Path, PathBuf}; use base64::prelude::BASE64_STANDARD; use base64::Engine; -use log::error; use serde::Deserialize; use serde::Serialize; +use tracing::error; use super::AppliableEdit; diff --git a/server/main-api/src/feedback/proposed_edits/mod.rs b/server/main-api/src/feedback/proposed_edits/mod.rs index 7fb91d368..3770a8e3e 100644 --- a/server/main-api/src/feedback/proposed_edits/mod.rs +++ b/server/main-api/src/feedback/proposed_edits/mod.rs @@ -4,6 +4,7 @@ use std::path::Path; use actix_web::web::{Data, Json}; use actix_web::{post, HttpResponse}; use serde::Deserialize; +use tracing::error; use super::github; use super::proposed_edits::coordinate::Coordinate; @@ -128,7 +129,7 @@ pub async fn propose_edits( .await } Err(e) => { - log::error!("Error while applying changes: {e}", e = e); + error!("Error while applying changes: {e}", e = e); HttpResponse::InternalServerError().finish() } } diff --git a/server/main-api/src/feedback/proposed_edits/tmp_repo.rs b/server/main-api/src/feedback/proposed_edits/tmp_repo.rs index 6edcab330..88e375af6 100644 --- a/server/main-api/src/feedback/proposed_edits/tmp_repo.rs +++ b/server/main-api/src/feedback/proposed_edits/tmp_repo.rs @@ -1,5 +1,5 @@ -use log::{debug, info}; use tokio::process::Command; +use tracing::{debug, info}; use super::discription::Description; use super::EditRequest; diff --git a/server/main-api/src/feedback/tokens.rs b/server/main-api/src/feedback/tokens.rs index 2f0459a0e..78bdfa8d5 100644 --- a/server/main-api/src/feedback/tokens.rs +++ b/server/main-api/src/feedback/tokens.rs @@ -1,8 +1,8 @@ use actix_web::HttpResponse; use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation}; -use log::error; use serde::{Deserialize, Serialize}; use tokio::sync::Mutex; +use tracing::error; #[derive(Default)] pub struct RecordedTokens(Mutex>); diff --git a/server/main-api/src/main.rs b/server/main-api/src/main.rs index 56bb638a4..5be299553 100644 --- a/server/main-api/src/main.rs +++ b/server/main-api/src/main.rs @@ -1,14 +1,17 @@ +use std::borrow::Cow; use std::collections::HashMap; use std::error::Error; use actix_cors::Cors; use actix_web::{get, middleware, web, App, HttpResponse, HttpServer}; use actix_web_prom::PrometheusMetricsBuilder; -use log::{debug, error, info}; use meilisearch_sdk::client::Client; +use sentry::SessionMode; use sqlx::postgres::PgPoolOptions; use sqlx::prelude::*; use sqlx::PgPool; +use tracing::{debug, error, info}; +use tracing_subscriber::fmt::Layer; mod calendar; mod details; @@ -30,9 +33,9 @@ pub struct AppData { #[get("/api/status")] async fn health_status_handler(data: web::Data) -> HttpResponse { - let github_link = match std::env::var("GIT_COMMIT_SHA") { - Ok(hash) => format!("https://github.com/TUM-Dev/navigatum/tree/{hash}"), - Err(_) => "unknown commit hash, probably running in development".to_string(), + let github_link = match option_env!("GIT_COMMIT_SHA") { + Some(hash) => format!("https://github.com/TUM-Dev/navigatum/tree/{hash}"), + None => "unknown commit hash, probably running in development".to_string(), }; return match data.db.execute("SELECT 1").await { Ok(_) => HttpResponse::Ok() @@ -56,35 +59,53 @@ fn connection_string() -> String { } pub fn setup_logging() { - #[cfg(any(debug_assertions, test))] - { - let log_level = std::env::var("LOG_LEVEL").unwrap_or_else(|_| "debug".to_string()); - let filter = format!("{log_level},hyper=info,rustls=info,h2=info,sqlx=info,hickory_resolver=info,hickory_proto=info"); - let env = env_logger::Env::default().default_filter_or(&filter); - let _ = env_logger::Builder::from_env(env) - .is_test(cfg!(test)) - .try_init(); - } - #[cfg(not(any(debug_assertions, test)))] - { - let log_level = std::env::var("LOG_LEVEL").unwrap_or_else(|_| "info".to_string()); - let _ = structured_logger::Builder::with_level(&log_level) - .with_target_writer( - "*", - structured_logger::async_json::new_writer(tokio::io::stdout()), - ) - .try_init(); - } + use tracing_subscriber::filter::EnvFilter; + use tracing_subscriber::prelude::*; + let default_level = if cfg!(any(debug_assertions, test)) { + "debug" + } else { + "info" + }; + let log_level = std::env::var("LOG_LEVEL").unwrap_or_else(|_| default_level.to_string()); + // these overrides exist to filter away stuff I don't think we should ever care about + let filter = format!("{log_level},hyper=info,rustls=info,h2=info,sqlx=info,hickory_resolver=info,hickory_proto=info"); + + let filter = EnvFilter::builder().parse_lossy(filter); + + let registry = tracing_subscriber::registry() + .with(filter) + .with(cfg!(not(any(debug_assertions, test))).then(|| Layer::default().json())) + .with(cfg!(any(debug_assertions, test)).then(|| Layer::default().pretty())); + tracing::subscriber::set_global_default(registry).unwrap(); } -#[tokio::main] -async fn main() -> Result<(), BoxedError> { +fn main() -> Result<(), BoxedError> { setup_logging(); + let release = match option_env!("GIT_COMMIT_SHA") { + Some(s) => Some(Cow::Borrowed(s)), + None => sentry::release_name!(), + }; + let _guard = sentry::init(( + "https://8f2054d6294447a1b573ea4badb76778@sentry.mm.rbg.tum.de/8", + sentry::ClientOptions { + release, + traces_sample_rate: 1.0, + session_mode: SessionMode::Request, + ..Default::default() + }, + )); + std::env::set_var("RUST_BACKTRACE", "1"); + + actix_web::rt::System::new().block_on(async { run().await })?; + Ok(()) +} +/// we split main and run because otherwise sentry could not be properly instrumented +async fn run() -> Result<(), BoxedError> { let maintenance_thread = tokio::spawn(async move { let pool = PgPoolOptions::new() .connect(&connection_string()) .await - .unwrap(); + .expect("make sure that postgres is running in the background"); #[cfg(not(feature = "skip_ms_setup"))] { let ms_url = @@ -104,17 +125,21 @@ async fn main() -> Result<(), BoxedError> { debug!("setting up metrics"); let labels = HashMap::from([( "revision".to_string(), - std::env::var("GIT_COMMIT_SHA").unwrap_or_else(|_| "development".to_string()), + option_env!("GIT_COMMIT_SHA") + .unwrap_or_else(|| "development") + .to_string(), )]); let prometheus = PrometheusMetricsBuilder::new("navigatum_mainapi") .endpoint("/api/main/metrics") .const_labels(labels) .build() .unwrap(); - - info!("running the server"); - let pool = PgPoolOptions::new().connect(&connection_string()).await?; + let pool = PgPoolOptions::new() + .connect(&connection_string()) + .await + .expect("make sure that postgres is running in the background"); let shutdown_pool_clone = pool.clone(); + info!("running the server"); HttpServer::new(move || { let cors = Cors::default() .allow_any_origin() @@ -127,6 +152,7 @@ async fn main() -> Result<(), BoxedError> { .wrap(cors) .wrap(middleware::Logger::default().exclude("/api/status")) .wrap(middleware::Compress::default()) + .wrap(sentry_actix::Sentry::new()) .app_data(web::JsonConfig::default().limit(MAX_JSON_PAYLOAD)) .app_data(web::Data::new(AppData { db: pool.clone() })) .service(health_status_handler) diff --git a/server/main-api/src/maps/fetch_tile.rs b/server/main-api/src/maps/fetch_tile.rs index dba15de1d..ed4d2c062 100644 --- a/server/main-api/src/maps/fetch_tile.rs +++ b/server/main-api/src/maps/fetch_tile.rs @@ -2,7 +2,7 @@ use std::fmt::Display; use std::time::Duration; use std::{fmt, io}; -use log::{error, warn}; +use tracing::{error, warn}; use crate::maps::overlay_map::OverlayMapTask; use crate::BoxedError; diff --git a/server/main-api/src/maps/mod.rs b/server/main-api/src/maps/mod.rs index 5624a34f3..ebf63d1d4 100644 --- a/server/main-api/src/maps/mod.rs +++ b/server/main-api/src/maps/mod.rs @@ -3,11 +3,11 @@ use std::io::Cursor; use actix_web::http::header::LOCATION; use actix_web::{get, web, HttpResponse}; use image::{ImageBuffer, Rgba}; -use log::{debug, error, warn}; use serde::Deserialize; use sqlx::Error::RowNotFound; use sqlx::PgPool; use tokio::time::Instant; +use tracing::{debug, error, warn}; use unicode_truncate::UnicodeTruncateStr; use crate::maps::overlay_map::OverlayMapTask; diff --git a/server/main-api/src/maps/overlay_map.rs b/server/main-api/src/maps/overlay_map.rs index fd9888182..beda245e8 100644 --- a/server/main-api/src/maps/overlay_map.rs +++ b/server/main-api/src/maps/overlay_map.rs @@ -1,6 +1,6 @@ use futures::{stream::FuturesUnordered, StreamExt}; -use log::warn; use std::ops::Range; +use tracing::warn; use crate::maps::fetch_tile::FetchTileTask; use crate::models::Location; diff --git a/server/main-api/src/search/mod.rs b/server/main-api/src/search/mod.rs index 3335a01e0..a2ef13c5f 100644 --- a/server/main-api/src/search/mod.rs +++ b/server/main-api/src/search/mod.rs @@ -2,8 +2,8 @@ use std::time::Instant; use actix_web::{get, web, HttpResponse}; use cached::proc_macro::cached; -use log::{debug, error}; use serde::{Deserialize, Serialize}; +use tracing::{debug, error}; use unicode_truncate::UnicodeTruncateStr; mod search_executor; diff --git a/server/main-api/src/search/search_executor/mod.rs b/server/main-api/src/search/search_executor/mod.rs index ad941359c..5a4fce176 100644 --- a/server/main-api/src/search/search_executor/mod.rs +++ b/server/main-api/src/search/search_executor/mod.rs @@ -1,5 +1,5 @@ -use log::error; use serde::Serialize; +use tracing::error; use crate::search::search_executor::parser::ParsedQuery; use crate::search::search_executor::query::MSHit; diff --git a/server/main-api/src/search/search_executor/parser.rs b/server/main-api/src/search/search_executor/parser.rs index 04ca019c7..709180d91 100644 --- a/server/main-api/src/search/search_executor/parser.rs +++ b/server/main-api/src/search/search_executor/parser.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; -use log::warn; use logos::Logos; +use tracing::warn; use crate::search::search_executor::lexer::Token; diff --git a/server/main-api/src/setup/database/alias.rs b/server/main-api/src/setup/database/alias.rs index 06543df3f..f965a1189 100644 --- a/server/main-api/src/setup/database/alias.rs +++ b/server/main-api/src/setup/database/alias.rs @@ -1,7 +1,7 @@ use std::time::Instant; -use log::debug; use serde::Deserialize; +use tracing::debug; #[derive(Debug)] pub(super) struct Alias { diff --git a/server/main-api/src/setup/database/data.rs b/server/main-api/src/setup/database/data.rs index 72439d82e..d29ea2622 100644 --- a/server/main-api/src/setup/database/data.rs +++ b/server/main-api/src/setup/database/data.rs @@ -1,8 +1,8 @@ use std::collections::HashMap; use std::time::Instant; -use log::debug; use serde_json::Value; +use tracing::debug; pub(super) struct DelocalisedValues { key: String, diff --git a/server/main-api/src/setup/database/mod.rs b/server/main-api/src/setup/database/mod.rs index 970e8617e..e3acb76a9 100644 --- a/server/main-api/src/setup/database/mod.rs +++ b/server/main-api/src/setup/database/mod.rs @@ -1,6 +1,6 @@ use std::time::Instant; -use log::{debug, info}; +use tracing::{debug, info}; mod alias; mod data; @@ -56,6 +56,17 @@ async fn find_keys_which_need_updating( hashes: &[i64], ) -> Result, crate::BoxedError> { let start = Instant::now(); + let number_of_keys = sqlx::query_scalar!("SELECT COUNT(*) FROM de") + .fetch_one(pool) + .await?; + if number_of_keys == Some(0) { + debug!( + "all {updated_cnt} keys need upating", + updated_cnt = keys.len() + ); + return Ok(keys.to_vec()); + } + let mut keys_which_need_updating = sqlx::query_scalar!( r#" SELECT de.key @@ -94,6 +105,9 @@ async fn cleanup_deleted( sqlx::query!("DELETE FROM en WHERE NOT EXISTS (SELECT * FROM UNNEST($1::text[]) AS expected(key) WHERE en.key = expected.key)", keys) .execute(&mut **tx) .await?; + sqlx::query!("DELETE FROM calendar WHERE NOT EXISTS (SELECT * FROM UNNEST($1::text[]) AS expected(key) WHERE calendar.room_code = expected.key)", keys) + .execute(&mut **tx) + .await?; sqlx::query!("DELETE FROM de WHERE NOT EXISTS (SELECT * FROM UNNEST($1::text[]) AS expected(key) WHERE de.key = expected.key)", keys) .execute(&mut **tx) .await?; diff --git a/server/main-api/src/setup/meilisearch.rs b/server/main-api/src/setup/meilisearch.rs index a55a6a90b..7bd90376d 100644 --- a/server/main-api/src/setup/meilisearch.rs +++ b/server/main-api/src/setup/meilisearch.rs @@ -1,11 +1,11 @@ use std::collections::HashMap; use std::time::Duration; -use log::{debug, error, info}; use meilisearch_sdk::client::Client; use meilisearch_sdk::settings::Settings; use meilisearch_sdk::tasks::Task; use serde_json::Value; +use tracing::{debug, error, info}; const TIMEOUT: Option = Some(Duration::from_secs(20)); const POLLING_RATE: Option = Some(Duration::from_millis(50));