| search_loop | R Documentation |
Infinite loop ensuring the permanent collection of social media messages
search_loop(
data_dir = NA,
sandboxed = FALSE,
log_to_file = !logs_to_stdout(),
max_requests = 0
)
search_loop_worker(network, data_dir = NA, sandboxed = FALSE, max_requests = 0)
data_dir |
The data directory to use. |
sandboxed |
Whether to run in sandboxed mode. |
log_to_file |
logical indicating if the search loop should log to a file, one per collected network (jobs/search.<network>.log). When FALSE every worker writes to the standard output of this process instead, which is what a container deployment needs - nothing collects a file inside a pod. Default: FALSE when the environment variable 'EPISOMER_LOGS_TO_STDOUT' is set to TRUE, TRUE otherwise |
max_requests |
The maximum number of requests to perform. |
network |
The social media network to search on. |
The detect loop is a pure R function designed for downloading posts from the social media search API. It can handle several topics ensuring that all of them will be downloaded fairly using a round-robin philosophy and respecting social media API rate-limits.
The progress of this task is reported on the 'topics.*.json' files which are created by this function. This function will try to collect posts respecting a 'collect_span' window in minutes, which is defined on the Shiny app and defaults to 60 minutes.
To see more details about the collection algorithm please see episomer vignette.
In order to work, this task needs Bluesky and/or Mastodon credentials,
which can be set on the Shiny app or using sm_api_set_auth_bluesky or
sm_api_set_auth_mastodon
The search loop worker is a function that runs the search loop for a given social media network. It is used to run the search loop in a separate process.
Nothing
Invisibly, why the worker stopped: "lease-lost" when another instance took this
network over, "ended" when max_requests was reached. Read by search_loop()
to tell an orderly handover from an unexpected end. A failed request does not stop the worker,
it is logged and tried again; only search_max_request_failures() consecutive failures do,
and that one raises rather than returning.
sm_api_set_auth_bluesky
sm_api_set_auth_mastodon
## Not run:
#Running the search loop
library(episomer)
message('Please choose the episomer data directory')
search_loop(file.choose())
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.