Skip to content

Commit

Permalink
fix(clusters): fix tls renew query (#1026)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Aug 7, 2024
1 parent 6f7c94c commit 81a7b7a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
36 changes: 36 additions & 0 deletions docs/libraries/workflow/USEFUL_QUERIES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Aggregate entire history

```sql
SELECT location, 'activity' AS t, activity_name AS name
FROM db_workflow.workflow_activity_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'signal' AS t, signal_name AS name
FROM db_workflow.workflow_signal_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'sub_workflow' AS t, sub_workflow_id::STRING AS name
FROM db_workflow.workflow_sub_workflow_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'signal_send' AS t, signal_name AS name
FROM db_workflow.workflow_signal_send_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'message_send' AS t, message_name AS name
FROM db_workflow.workflow_message_send_events
WHERE
workflow_id = $1 AND NOT forgotten
UNION ALL
SELECT location, 'loop' AS t, NULL AS name
FROM db_workflow.workflow_loop_events
WHERE
workflow_id = $1 AND NOT forgotten
ORDER BY location ASC;
```

> Remove `AND NOT forgotten` to show all events, including past loop executions
4 changes: 0 additions & 4 deletions lib/chirp-workflow/core/src/ctx/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ pub struct WorkflowCtx {
conn: rivet_connection::Connection,

/// All events that have ever been recorded on this workflow.
///
/// If replaying, the workflow will check that the `ActivityId` is the same for all activities
/// to make sure the workflow hasn't diverged.
///
/// The reason this type is a hashmap is to allow querying by location.
event_history: Arc<HashMap<Location, Vec<Event>>>,
/// Input data passed to this workflow.
Expand Down
1 change: 0 additions & 1 deletion svc/pkg/cluster/standalone/datacenter-tls-renew/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub async fn run_from_env(pools: rivet_pools::Pools) -> GlobalResult<()> {
"
UPDATE db_cluster.datacenter_tls
SET state2 = $3
FROM db_cluster.datacenter_tls
WHERE
state2 = $1 AND
expire_ts < $2
Expand Down

0 comments on commit 81a7b7a

Please sign in to comment.