add tracing debug around user auth

This commit is contained in:
Ruben Fiszel
2024-02-13 13:30:33 +01:00
parent 5c5c9c5ac4
commit 54ad67e84a
5 changed files with 17 additions and 7 deletions
+9
View File
@@ -80,6 +80,15 @@ impl UserDB {
let mut folders_read = folders_read.clone();
folders_read.extend(folders_write.clone());
tracing::debug!(
"Setting role to {} {:?} {:?} {:?} {:?}",
user,
authed.username(),
authed.groups(),
folders_read,
folders_write
);
let mut tx = self.db.begin().await?;
sqlx::query(&format!("SET LOCAL ROLE {}", user))
+1 -1
View File
@@ -104,7 +104,7 @@ pub async fn send_stats(
let uid = get_uid(db).await?;
let jobs_usage = sqlx::query_as::<_, JobsUsage>(
"SELECT language, COUNT(*) as count, SUM(duration_ms)::BIGINT as total_duration FROM completed_job GROUP BY language",
"SELECT language, COUNT(*) as count, SUM(duration_ms)::BIGINT as total_duration FROM completed_job WHERE started_at > NOW() - INTERVAL '4 weeks' GROUP BY language LIMIT 100000",
)
.fetch_all(db)
.await?;
+1 -1
View File
@@ -1342,7 +1342,7 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
pull(&db, rsmq.clone(), suspend_first).map(|x| (x, pull_time)).await
} => {
add_time!(timing, loop_start, "post pull");
tracing::debug!("pulled job: {:?}", job.as_ref().ok().and_then(|x| x.as_ref().map(|y| y.id)));
// tracing::debug!("pulled job: {:?}", job.as_ref().ok().and_then(|x| x.as_ref().map(|y| y.id)));
let duration_pull_s = timer.elapsed().as_secs_f64();
let err_pull = job.is_ok();
let empty = job.as_ref().is_ok_and(|x| x.is_none());
@@ -103,7 +103,6 @@
let selectedRowIndex = -1
function toggleRow(row: Record<string, any>, force: boolean = false) {
console.log(row)
let data = { ...row.original }
let index = data['__index']
delete data['__index']
@@ -141,9 +140,10 @@
if (searchValue === '') {
return result
}
return result.filter((row) =>
Object.values(row).some((value) => value?.toString()?.includes(searchValue))
)
return result.filter((row) => {
// console.log(Object.values(row).map((value) => value?.toString()))
return Object.values(row).some((value) => value?.toString()?.includes(searchValue))
})
}
function renderCell(x: any, props: any): any {
@@ -157,6 +157,7 @@
let filteredResult: Array<Record<string, any>> = []
function setFilteredResult() {
console.log('setting filtered result')
const wIndex = Array.isArray(result)
? (result as any[]).map((x, i) => ({ ...x, __index: i }))
: [{ error: 'input was not an array' }]
+1 -1
View File
@@ -470,7 +470,7 @@ export function addWhitespaceBeforeCapitals(word?: string): string {
}
export function isObject(obj: any) {
return typeof obj === 'object'
return obj != null && typeof obj === 'object'
}
export function debounce(func: (...args: any[]) => any, wait: number) {