debug: fetch.worker, sqlite.worker
This commit is contained in:
parent
520c35db60
commit
667d00bbd0
|
@ -1,13 +1,16 @@
|
|||
import { Comlink } from '@/deps.ts';
|
||||
import { Comlink, Debug } from '@/deps.ts';
|
||||
|
||||
import './handlers/abortsignal.ts';
|
||||
|
||||
const debug = Debug('ditto:fetch.worker');
|
||||
|
||||
export const FetchWorker = {
|
||||
async fetch(
|
||||
url: string,
|
||||
init: Omit<RequestInit, 'signal'>,
|
||||
signal: AbortSignal | null | undefined,
|
||||
): Promise<[BodyInit, ResponseInit]> {
|
||||
debug(init.method, url);
|
||||
const response = await fetch(url, { ...init, signal });
|
||||
return [
|
||||
await response.arrayBuffer(),
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/// <reference lib="webworker" />
|
||||
|
||||
import { Comlink, type CompiledQuery, DenoSqlite3, type QueryResult, Sentry } from '@/deps.ts';
|
||||
import { Comlink, type CompiledQuery, Debug, DenoSqlite3, type QueryResult, Sentry } from '@/deps.ts';
|
||||
import '@/sentry.ts';
|
||||
|
||||
let db: DenoSqlite3 | undefined;
|
||||
const debug = Debug('ditto:sqlite.worker');
|
||||
|
||||
export const SqliteWorker = {
|
||||
open(path: string): void {
|
||||
|
@ -11,6 +12,7 @@ export const SqliteWorker = {
|
|||
},
|
||||
executeQuery<R>({ sql, parameters }: CompiledQuery): QueryResult<R> {
|
||||
if (!db) throw new Error('Database not open');
|
||||
debug(sql);
|
||||
|
||||
const result: QueryResult<R> = Sentry.startSpan({ name: sql, op: 'db.query' }, () => {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue