View Source Glific.GCS.GcsWorker (Glific v5.1.6)
Process the media table for each organization. Chunk number of message medias in groups of 128 and create a Gcs Worker Job to deliver the message media url to the gcs servers
We centralize both the cron job and the worker job in one module
Link to this section Summary
Functions
Download a file to the specific path. Should move this to a more generic helper file in glific
Standard perform method to use Oban worker
This is called from the cron job on a regular schedule. we sweep the message media url table and queue them up for delivery to gcs
Queue urls for gcs jobs.
Public interface to upload a file provided by the org at local name to gcs as remote name
Link to this section Functions
@spec download_file_to_temp(String.t(), String.t(), non_neg_integer()) :: {:ok, String.t()} | {:error, any()}
Download a file to the specific path. Should move this to a more generic helper file in glific
@spec perform(Oban.Job.t()) :: :ok | {:error, String.t()} | {:discard, String.t()}
Standard perform method to use Oban worker
@spec perform_periodic(non_neg_integer()) :: :ok
This is called from the cron job on a regular schedule. we sweep the message media url table and queue them up for delivery to gcs
@spec queue_urls(non_neg_integer(), non_neg_integer(), non_neg_integer()) :: :ok
Queue urls for gcs jobs.
@spec upload_media(String.t(), String.t(), non_neg_integer()) :: {:ok, map()} | {:error, String.t()}
Public interface to upload a file provided by the org at local name to gcs as remote name