From be48eaaeff98d05114f97c4685ed2301ada0246d Mon Sep 17 00:00:00 2001 From: HugoCasa Date: Wed, 7 Aug 2024 17:52:39 +0200 Subject: [PATCH] fix: handle >1 num workers stats (#4177) * fix: handle >1 num workers stats * fix: sqlx * fix: ee ref test * fix: sqlx + ee ref * update ee ref --- ...a738594a2b7eaab8e38f3ca30e548f9a49a7.json} | 4 +- ...4b243615484bbad5a793438e23908c3f20c2f.json | 26 ------------- ...679366bb07bc6a100727721a787160ac6910c.json | 38 +++++++++++++++++++ backend/ee-repo-ref.txt | 2 +- 4 files changed, 41 insertions(+), 29 deletions(-) rename backend/.sqlx/{query-43cc4e7d9846dbce81b61a25e8ceca636a08451db3288969ed9105fa0cb4e5b8.json => query-a51007ca7b509b92faa6fe7aa59fa738594a2b7eaab8e38f3ca30e548f9a49a7.json} (89%) delete mode 100644 backend/.sqlx/query-ad8d9c00bd2d3515ad4afa87aa24b243615484bbad5a793438e23908c3f20c2f.json create mode 100644 backend/.sqlx/query-cce991f582bc9d2ba28a5b2b41c679366bb07bc6a100727721a787160ac6910c.json diff --git a/backend/.sqlx/query-43cc4e7d9846dbce81b61a25e8ceca636a08451db3288969ed9105fa0cb4e5b8.json b/backend/.sqlx/query-a51007ca7b509b92faa6fe7aa59fa738594a2b7eaab8e38f3ca30e548f9a49a7.json similarity index 89% rename from backend/.sqlx/query-43cc4e7d9846dbce81b61a25e8ceca636a08451db3288969ed9105fa0cb4e5b8.json rename to backend/.sqlx/query-a51007ca7b509b92faa6fe7aa59fa738594a2b7eaab8e38f3ca30e548f9a49a7.json index c9e2657ddd..7e1f008dba 100644 --- a/backend/.sqlx/query-43cc4e7d9846dbce81b61a25e8ceca636a08451db3288969ed9105fa0cb4e5b8.json +++ b/backend/.sqlx/query-a51007ca7b509b92faa6fe7aa59fa738594a2b7eaab8e38f3ca30e548f9a49a7.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT worker, worker_instance, vcpus, memory, ping_at, started_at FROM worker_ping WHERE ping_at > now() - interval '30 days'", + "query": "SELECT worker, worker_instance, vcpus, memory, ping_at, started_at FROM worker_ping WHERE ping_at > now() - interval '30 days' ORDER BY started_at", "describe": { "columns": [ { @@ -46,5 +46,5 @@ false ] }, - "hash": "43cc4e7d9846dbce81b61a25e8ceca636a08451db3288969ed9105fa0cb4e5b8" + "hash": "a51007ca7b509b92faa6fe7aa59fa738594a2b7eaab8e38f3ca30e548f9a49a7" } diff --git a/backend/.sqlx/query-ad8d9c00bd2d3515ad4afa87aa24b243615484bbad5a793438e23908c3f20c2f.json b/backend/.sqlx/query-ad8d9c00bd2d3515ad4afa87aa24b243615484bbad5a793438e23908c3f20c2f.json deleted file mode 100644 index 830194da26..0000000000 --- a/backend/.sqlx/query-ad8d9c00bd2d3515ad4afa87aa24b243615484bbad5a793438e23908c3f20c2f.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH active_users as (SELECT distinct username as email FROM audit WHERE timestamp > NOW() - INTERVAL '1 month' AND (operation = 'users.login' OR operation = 'oauth.login')),\n active_user_count as (SELECT count(email)::INT as count from active_users),\n active_author_count as (SELECT count(distinct email)::INT as count FROM usr WHERE usr.operator IS false AND email IN (SELECT email FROM active_users))\n SELECT active_author_count.count as author_count, active_user_count.count - active_author_count.count as operator_count FROM active_user_count, active_author_count", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "author_count", - "type_info": "Int4" - }, - { - "ordinal": 1, - "name": "operator_count", - "type_info": "Int4" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - null, - null - ] - }, - "hash": "ad8d9c00bd2d3515ad4afa87aa24b243615484bbad5a793438e23908c3f20c2f" -} diff --git a/backend/.sqlx/query-cce991f582bc9d2ba28a5b2b41c679366bb07bc6a100727721a787160ac6910c.json b/backend/.sqlx/query-cce991f582bc9d2ba28a5b2b41c679366bb07bc6a100727721a787160ac6910c.json new file mode 100644 index 0000000000..f5d905a157 --- /dev/null +++ b/backend/.sqlx/query-cce991f582bc9d2ba28a5b2b41c679366bb07bc6a100727721a787160ac6910c.json @@ -0,0 +1,38 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH active_users as (SELECT distinct username as email FROM audit WHERE timestamp > NOW() - INTERVAL '1 month' AND (operation = 'users.login' OR operation = 'oauth.login')),\n active_authors as (SELECT distinct email FROM usr WHERE usr.operator IS false AND email IN (SELECT email FROM active_users)),\n active_authors_agg as (SELECT array_agg(email) as authors FROM active_authors),\n active_ops_agg as (SELECT array_agg(email) as operators from active_users WHERE email NOT IN (SELECT email FROM active_authors))\n SELECT active_authors_agg.authors, active_ops_agg.operators, array_length(active_authors_agg.authors, 1) as author_count, array_length(active_ops_agg.operators, 1) as operator_count FROM active_authors_agg, active_ops_agg", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "authors", + "type_info": "VarcharArray" + }, + { + "ordinal": 1, + "name": "operators", + "type_info": "VarcharArray" + }, + { + "ordinal": 2, + "name": "author_count", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "operator_count", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null, + null, + null, + null + ] + }, + "hash": "cce991f582bc9d2ba28a5b2b41c679366bb07bc6a100727721a787160ac6910c" +} diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index ab3aa07d2b..c9273eec97 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -6f1c4507f39515e05c6d6851446187996cd80844 +86cfcdef47f8b740cbbdf568f7a2282984ea7460 \ No newline at end of file