@go-avro/avro-js 1.6.6-rc3 → 1.6.6-rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/QueryClient.d.ts +9 -0
- package/dist/client/hooks/avro.js +13 -0
- package/dist/types/api/Avro.d.ts +61 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -280,6 +280,15 @@ declare module './QueryClient.js' {
|
|
|
280
280
|
msg: string;
|
|
281
281
|
cleared: number;
|
|
282
282
|
}, StandardError, void>>;
|
|
283
|
+
/**
|
|
284
|
+
* Root only: run scheduled jobs now (all of them when called with no
|
|
285
|
+
* ids). The scheduler starts them within a few seconds; watch their
|
|
286
|
+
* status in `useGetPerformanceMetrics`.
|
|
287
|
+
*/
|
|
288
|
+
useRunSchedulerJobs(): ReturnType<typeof useMutation<{
|
|
289
|
+
msg: string;
|
|
290
|
+
jobs: string[];
|
|
291
|
+
}, StandardError, string[] | void>>;
|
|
283
292
|
useSearchUsers(searchUsername: string): UseQueryResult<User[], StandardError>;
|
|
284
293
|
useMergeUsersPreview(keepId: string, duplicateId: string): UseQueryResult<UserMergeSummary, StandardError>;
|
|
285
294
|
useMergeUsers(): ReturnType<typeof useMutation<UserMergeSummary, StandardError, {
|
|
@@ -45,3 +45,16 @@ AvroQueryClient.prototype.useClearErrorLog = function () {
|
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
+
AvroQueryClient.prototype.useRunSchedulerJobs = function () {
|
|
49
|
+
const queryClient = this.getQueryClient();
|
|
50
|
+
return useMutation({
|
|
51
|
+
mutationFn: (jobIds) => this.post({
|
|
52
|
+
path: '/avro/scheduler/run',
|
|
53
|
+
data: JSON.stringify(jobIds ? { job_ids: jobIds } : {}),
|
|
54
|
+
headers: { 'Content-Type': 'application/json' },
|
|
55
|
+
}),
|
|
56
|
+
onSuccess: () => {
|
|
57
|
+
queryClient.invalidateQueries({ queryKey: ['avro', 'performance'] });
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
};
|
package/dist/types/api/Avro.d.ts
CHANGED
|
@@ -88,11 +88,55 @@ export interface PerformanceSample {
|
|
|
88
88
|
memory_percent: number;
|
|
89
89
|
}[];
|
|
90
90
|
}
|
|
91
|
+
/** A live scheduler process (`avro scheduler-worker`). */
|
|
92
|
+
export interface SchedulerWorker {
|
|
93
|
+
/** `<hostname>:<pid>` of the scheduler process. */
|
|
94
|
+
worker: string;
|
|
95
|
+
/** Unix seconds of the last heartbeat. */
|
|
96
|
+
time: number;
|
|
97
|
+
/** Unix seconds when the process started its scheduler. */
|
|
98
|
+
started_at: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Latest run state of a scheduled job. `pending` until its first run since
|
|
102
|
+
* the worker started; `locked` when the last run skipped because another
|
|
103
|
+
* process held the job's Redis lock. A run skipped because the previous one
|
|
104
|
+
* is still going leaves it `running` and sets `last_skipped`.
|
|
105
|
+
*/
|
|
106
|
+
export type SchedulerJobStatus = 'pending' | 'running' | 'ok' | 'error' | 'missed' | 'locked';
|
|
107
|
+
/** A scheduled job and its latest run (times are Unix seconds). */
|
|
108
|
+
export interface SchedulerJob {
|
|
109
|
+
/** The job's function name, e.g. `update_routes`. */
|
|
110
|
+
id: string;
|
|
111
|
+
/** E.g. `cron[hour='1', minute='0', second='0']`. */
|
|
112
|
+
trigger: string | null;
|
|
113
|
+
status: SchedulerJobStatus | null;
|
|
114
|
+
next_run_time: number | null;
|
|
115
|
+
last_started: number | null;
|
|
116
|
+
last_finished: number | null;
|
|
117
|
+
last_success: number | null;
|
|
118
|
+
last_skipped: number | null;
|
|
119
|
+
/** Last run skipped because another process held the job's lock. */
|
|
120
|
+
last_locked: number | null;
|
|
121
|
+
/** The Redis lock that was held on the last `locked` run. */
|
|
122
|
+
lock_name: string | null;
|
|
123
|
+
/** Of the last finished run. */
|
|
124
|
+
duration_seconds: number | null;
|
|
125
|
+
last_error: string | null;
|
|
126
|
+
last_error_time: number | null;
|
|
127
|
+
}
|
|
128
|
+
/** Scheduler health: live processes and every job's latest run. */
|
|
129
|
+
export interface PerformanceScheduler {
|
|
130
|
+
/** Empty when no scheduler process is alive. */
|
|
131
|
+
workers: SchedulerWorker[];
|
|
132
|
+
jobs: SchedulerJob[];
|
|
133
|
+
}
|
|
91
134
|
/** Response of GET /avro/performance (root only). */
|
|
92
135
|
export interface PerformanceMetrics {
|
|
93
136
|
current: {
|
|
94
137
|
database: PerformanceDatabase;
|
|
95
138
|
fleet: PerformanceFleet;
|
|
139
|
+
scheduler: PerformanceScheduler;
|
|
96
140
|
};
|
|
97
141
|
/** Oldest first. */
|
|
98
142
|
samples: PerformanceSample[];
|
|
@@ -108,11 +152,15 @@ export interface ClientErrorReport {
|
|
|
108
152
|
route?: string;
|
|
109
153
|
extra?: Record<string, unknown>;
|
|
110
154
|
}
|
|
111
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* One entry in the admin error log (backend errors, client crashes and
|
|
157
|
+
* scheduler job failures). Scheduler entries carry no request context:
|
|
158
|
+
* `endpoint` is the job id and the request fields are absent.
|
|
159
|
+
*/
|
|
112
160
|
export interface ErrorLogEntry {
|
|
113
161
|
id: string;
|
|
114
162
|
time: number;
|
|
115
|
-
source: 'backend' | 'app' | 'web';
|
|
163
|
+
source: 'backend' | 'app' | 'web' | 'scheduler';
|
|
116
164
|
/** HTTP status; absent from client reports. */
|
|
117
165
|
status?: number | null;
|
|
118
166
|
message: string | null;
|
|
@@ -123,22 +171,20 @@ export interface ErrorLogEntry {
|
|
|
123
171
|
app_version?: string | null;
|
|
124
172
|
update_id?: string | null;
|
|
125
173
|
route?: string | null;
|
|
126
|
-
method
|
|
127
|
-
path
|
|
128
|
-
endpoint
|
|
129
|
-
client_id
|
|
130
|
-
client_version
|
|
131
|
-
js_version
|
|
132
|
-
user_agent
|
|
133
|
-
remote_addr
|
|
134
|
-
forwarded_for
|
|
135
|
-
source_ip
|
|
136
|
-
|
|
137
|
-
user: {
|
|
174
|
+
method?: string | null;
|
|
175
|
+
path?: string | null;
|
|
176
|
+
endpoint?: string | null;
|
|
177
|
+
client_id?: string | null;
|
|
178
|
+
client_version?: string | null;
|
|
179
|
+
js_version?: string | null;
|
|
180
|
+
user_agent?: string | null;
|
|
181
|
+
remote_addr?: string | null;
|
|
182
|
+
forwarded_for?: string | null;
|
|
183
|
+
source_ip?: string | null;
|
|
184
|
+
user?: {
|
|
138
185
|
id: string;
|
|
139
186
|
username: string;
|
|
140
187
|
is_paying?: boolean | null;
|
|
141
188
|
} | string | null;
|
|
142
|
-
/** A string when the stored value was too long and was truncated to its JSON text. */
|
|
143
189
|
extra?: Record<string, unknown> | string | null;
|
|
144
190
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AVRO_JS_VERSION = "1.6.6-
|
|
1
|
+
export declare const AVRO_JS_VERSION = "1.6.6-rc5";
|
package/dist/version.js
CHANGED