Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Changed Tamarin

Compare
Choose a tag to compare
@LucasRoesler LucasRoesler released this 11 Sep 13:16
cbc72c3
Use INSERT ON CONFLICT for retention task upsert (#60)

* Use INSERT ON CONFLICT for retention task upsert

**What**
- When deploying some of the apps with the retention policy, we saw the
  startup get stuck during the retention task assertion. Moving a an
  INSERT ON CONFLICT upsert method avoids the table lock and has the
  same effect.
- Add a partial unique index to the schedules table that is required for
  the upsert flow
- Any project using the retention policies will need to add this
  migration to their startup

```sql
CREATE UNIQUE INDEX IF NOT EXISTS unique_retention_idx
ON schedules (task_queue, task_type, (task_spec->>'queueName'), (task_spec->>'taskType'), (task_spec->>'status'))
WHERE task_type = 'retention';
```

Signed-off-by: Lucas Roesler <[email protected]>