Skip to content

Commit

Permalink
Move SearXNG instance check to nightly build
Browse files Browse the repository at this point in the history
searx.space includes metrics for instance uptime, which is now
implemented as part of farside's nightly build. Accordingly, the
instance availability task built into farside now excludes searxng
instances.

Closes #95
  • Loading branch information
benbusby committed Apr 5, 2023
1 parent 65c1276 commit bb3a01f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update-instances.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
select(.value.version | . != null) |
select(.value.network.asn_privacy == 0) |
select(.value.http.error == null) |
select(.value.uptime.uptimeDay >= 99) |
select(.value.tls.grade == "A+" or .value.tls.grade == "A") |
select(.value.http.grade == "A+" or .value.http.grade == "A") |
select(.value.html.grade == "V" or .value.html.grade == "F") |
Expand Down
34 changes: 21 additions & 13 deletions lib/farside/instances.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ defmodule Farside.Instances do
@debug_header "======== "
@debug_spacer " "

# SearXNG instance uptimes are inspected as part of the nightly Farside build,
# and should not be included in the constant periodic update.
@skip_service_updates ["searxng"]

def sync() do
File.rename(@update_file, "#{@update_file}-prev")
update()
Expand Down Expand Up @@ -51,19 +55,23 @@ defmodule Farside.Instances do

IO.puts("#{@debug_header}#{service.type}")

result =
Enum.filter(service.instances, fn instance_url ->
request_url =
instance_url <>
EEx.eval_string(
service.test_url,
query: Enum.random(@queries)
)

IO.puts("#{@debug_spacer}#{request_url}")

request(request_url) == :good
end)
result = cond do
Enum.member?(@skip_service_updates, service.type) ->
service.instances
true ->
Enum.filter(service.instances, fn instance_url ->
request_url =
instance_url <>
EEx.eval_string(
service.test_url,
query: Enum.random(@queries)
)

IO.puts("#{@debug_spacer}#{request_url}")

request(request_url) == :good
end)
end

add_to_db(service, result)
log_results(service.type, result)
Expand Down

0 comments on commit bb3a01f

Please sign in to comment.