Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Digital Ocean Provider - Get The Real ID of a Snapshot #8

Open
elindydotcom opened this issue Oct 28, 2021 · 1 comment
Open
Labels
enhancement New feature or request Hold Hold Priority: Medium Medium priority

Comments

@elindydotcom
Copy link
Contributor

Introduction

When we initiate a snapshot operation, we get an integer back from the API. BUT, that integer is not the id of the snapshot. Digital Ocean does not return the snapshot id until the operation is over. Instead, the ID has to be used to poll the DO api to get the status of the snapshot and then obtain its [the snapshot] id after the operation is complete.

Proposed Solution

After the snapshot operation is initiated, add a task to our background task table (aka the pending logs CPT).

We will need to add a corresponding action hook to the DO provider to handle querying the DO api for the status of the operation. If the operation is still in progress we'll need to re-add the task into the background task table and keep doing that until the operation is complete.

One issue here is that we'll be querying the DO api at least once per minute per snapshot. If we do not want to do this that often, we'll need to add a new feature to the function that scans the background task table and dispatches tasks from it. We will need to modify it to optionally only dispatch a task after a particular date/time is met. This way we can add our tasks to the table with specified future date to be run.

Why don't we use the WP CRON? Ans: We want as many WPCD tasks as possible to be centralized and monitored in one location.

Why We Need This

We can start to store the IDs of snapshots in our own tables so that we can then allow for on-demand or scheduled deletions.

Primary Files Affected

  • core/providers/class-digital-ocean-parent.php
@elindydotcom elindydotcom added enhancement New feature or request Priority: Medium Medium priority labels Oct 28, 2021
@elindydotcom elindydotcom added the Hold Hold label Jan 4, 2022
@elindydotcom
Copy link
Contributor Author

Have to put this on hold because DO's api does not actually provide the data we need to get the status of a snapshot that was requested via the API. It's a hole in the API for snapshots but DO has not committed to a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hold Hold Priority: Medium Medium priority
Projects
None yet
Development

No branches or pull requests

1 participant