@dionlarson/playwright-orchestrator-mysql 1.3.9 → 1.4.0

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.
@@ -17,6 +17,7 @@ export declare class MySQLAdapter extends Adapter {
17
17
  startShard(runId: string): Promise<TestRunConfig>;
18
18
  finishShard(runId: string): Promise<void>;
19
19
  dispose(): Promise<void>;
20
+ cleanupStaleTests(runId: string, staleMinutes: number): Promise<number>;
20
21
  getReportData(runId: string): Promise<TestRunReport>;
21
22
  private loadTestInfos;
22
23
  private updateTestWithResult;
@@ -208,6 +208,17 @@ export class MySQLAdapter extends Adapter {
208
208
  async dispose() {
209
209
  await this.pool.end();
210
210
  }
211
+ async cleanupStaleTests(runId, staleMinutes) {
212
+ const [result] = await this.pool.query({
213
+ sql: `UPDATE ??
214
+ SET status = ?, updated = CURRENT_TIMESTAMP
215
+ WHERE run_id = UUID_TO_BIN(?)
216
+ AND status = ?
217
+ AND updated < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ? MINUTE)`,
218
+ values: [this.testsTable, TestStatus.Ready, runId, TestStatus.Ongoing, staleMinutes],
219
+ });
220
+ return result.affectedRows;
221
+ }
211
222
  async getReportData(runId) {
212
223
  const [[run]] = await this.pool.query({
213
224
  sql: `SELECT * FROM ??
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dionlarson/playwright-orchestrator-mysql",
3
- "version": "1.3.9",
3
+ "version": "1.4.0",
4
4
  "keywords": [],
5
5
  "author": "Rostyslav Kudrevatykh",
6
6
  "license": "Apache-2.0",