Plugin development - do something periodically without API call

Hi!

I wrote a vault secrets plugin that works just fine in terms of: here is your command on a given path and do something. My secrets plugin does not only handle the secrets, but it also writes specific parts of my secret plugins to a third party service. The problem is, that this third party service might not be reachable 100% of the time.
So what currently built is something like: vault write myplugin/mypath/mything/thing
This write command issues the creation of my “secret” and also the write to the third party service.
It would be nice if i could find a way of doing those writes to the third party system independently and in background periodically without the user interacting with vault. So, once my thing is created, it shall write it periodically with a given interval.

Is there a simple way of doing this given the vault plugin framework code structure?

I’d experiment with starting a goroutine from the plugin’s InitializeFunc, to handle background operations.

There’s also a PeriodicFunc that Vault calls in every plugin every minute - though I’m not sure whether that’s suitable for performing potentially time-consuming operations in.