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

Check all feeds before aborting #45

Merged
merged 9 commits into from
Feb 27, 2024
Merged

Check all feeds before aborting #45

merged 9 commits into from
Feb 27, 2024

Conversation

bmos
Copy link

@bmos bmos commented Feb 26, 2024

Queue until end and abort if any error was raised

queue until end and abort if any error was raised
@bmos bmos marked this pull request as draft February 26, 2024 20:06
@bmos
Copy link
Author

bmos commented Feb 26, 2024

going to add Brett's suggestions
https://discussion.dsausa.org/t/dsa-feed-not-updating-github-actions/31234/15?u=wil.t

Copy link

@brettchalupa brettchalupa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This really helps see how many are failing and what needs to be cleaned up.

@bmos bmos marked this pull request as ready for review February 26, 2024 20:38
Copy link

@brettchalupa brettchalupa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvements! Looking good! This will make it easy to fix the busted feeds

tests/feedcheck.rb Outdated Show resolved Hide resolved
@bmos
Copy link
Author

bmos commented Feb 26, 2024

I believe this to be done other than some connection and SSL errors.

@brettchalupa
Copy link

brettchalupa commented Feb 26, 2024

@bmos for the SSL errors, I think just commenting out those sites from the ini is the best option. I checked out a few and they have expired SSL certs, which IMO means we shouldn't include them.

@bmos
Copy link
Author

bmos commented Feb 26, 2024

Certainly, but we probably also want the action log to continue checking the other sites rather than getting 'stuck' like it did for redirects prior to this PR

Copy link

@brettchalupa brettchalupa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working really well for me locally! I don't have merge power yet, but I think this will make it a lot easier to maintain into the future.

@bmos
Copy link
Author

bmos commented Feb 26, 2024

Any experience with async or parallel operations in Ruby?
Since it's talking to a bunch of different servers, the run time could easily be reduced.
This might actually be a better solution to #31

@brettchalupa
Copy link

@bmos yes! Breaking the array of feeds up into threads could help. Here's a generic example:

# Sample array
arr = [1, 2, 3, 4, 5]

# Define the operation to perform on each element
def process_element(element)
  sleep 1 # Simulate IO-bound operation
  element * 2
end

# Create threads and collect results
results = []
threads = arr.map do |element|
  Thread.new do
    results << process_element(element)
  end
end

# Wait for all threads to finish
threads.each(&:join)

# Print the results
puts results # => [2, 4, 6, 8, 10] (order might vary)

It should, in theory, be more efficient. It might require some slicing up the arrays into multiple. Let me know if I can help adapt given the example above is maybe too generic. 😂

@bmos
Copy link
Author

bmos commented Feb 27, 2024

Wow that was so much easier than implementing threading in any other language I have tried.

Can confirm, it's WAY faster with multiple workers. although, rather predictably, if you use more than 1 worker the console outputs get all scrambled (which defeats the purpose).

So it'll need more work to compile and print each line as a unit rather than doing each checkmark in realtime.

That being said, I'd still consider this ready to merge since it'll make a big difference right away to the usability of this validation script and improvements can be make later to enable the benefits of threading.

@bmos
Copy link
Author

bmos commented Feb 27, 2024

It now runs all the way through the whole file without getting stuck.

@bmos bmos merged commit 8b759de into dsa-ntc:master Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants