Commit 4416585
authored
Delete schedules after execution (#130)
When access is granted, an EventBridgeSchedule is created to fire when
access should be revoked. However the schedules are not deleted, and so
the list of schedules continues to grow, for ever.
This has the knock-on effect of making the revoke lambda run slower and
slower, as it has to paginate through more and more old schedules.
This commit sets the ActionAfterCompletion property on the schedule so
that once it has executed AWS will delete it. This means that the number
of schedules should remain fairly constant over a given period of time.
Note that I have not included anything here to delete old schedules, so
tidying-up an existing installation will be something that each team
will need to perform manually.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Sets ActionAfterCompletion=DELETE on all created EventBridge schedules
so they are removed after firing.
>
> - **Scheduler**:
> - Set `ActionAfterCompletion` to `DELETE` for schedules created in:
> - `schedule_revoke_event`
> - `schedule_group_revoke_event`
> - `schedule_discard_buttons_event`
> - `schedule_approver_notification_event`
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
be0f8c1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 437445f commit 4416585
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
| 232 | + | |
230 | 233 | | |
231 | 234 | | |
232 | 235 | | |
| |||
270 | 273 | | |
271 | 274 | | |
272 | 275 | | |
| 276 | + | |
273 | 277 | | |
274 | 278 | | |
275 | 279 | | |
| |||
0 commit comments