* Load article before creating a page view for an invalid one
This should resolve a validation error in PageView.create! when the
article does not exist (perhaps it was deleted, or the user suspended,
or it was invalid data sent from the client).
This had been happening dozens of times per day for the last 10
months.
* Use an intention revealing symbol instead of calculated id
Since we only require that find_by not find anything, pass a symbol
that's not going to be the id for any article under any conditions.
As an added benefit, this provides a clear indication of the purpose
of the symbol, without needing to mentally confirm that
```sql
SELECT * FROM articles
WHERE id IN (
SELECT (1 + MAX(id)) FROM articles
) LIMIT 1
```
actually never gives any articles back.
* Initial work to expand detection functionality
* Finish up functionality and tests
* Fix class name
* Fix tests
* Update spec/services/articles/enrich_image_attributes_spec.rb
Co-authored-by: Michael Kohl <citizen428@forem.com>
* Update spec/services/articles/enrich_image_attributes_spec.rb
Co-authored-by: Michael Kohl <citizen428@forem.com>
* Add inline animated image detection
* Do not detect animation during preview
* Promote FastImage as a dependency
* Add Articles::DetectAnimatedImages service
* Restore previous parsing
* Add and use Articles::DetectAnimatedImagesWorker
* Remove obsolete poc
* Properly detect images in the after commit callback
* Simplify logic
* Use a second guard clause
* Fix parsing of relative paths and add tests
* Have Articles::DetectAnimatedImages correctly detect relative images uploaded locally
* Change Articles::DetectAnimatedImagesWorker priority to medium
* Only one & required
* Add script to remove feature flag
* Remove :feeds_import feature flag and RssReader and related classes
* Change Feeds::ImportArticlesWorker signature to support Sidekiq Cron serialization
* Replace RssReader::Assembler with Feeds::AssembleArticleMarkdown
* Removing Assembler
* Add earlier_than to Feeds::Import
* Ignore feeds that have been imported in the last 4 hours
* Make earlier_than mandatory in Feeds::ImportArticlesWorker
* Add explanatory comment to how RssReaderFetchUserWorker works
* Add Feeds::ImportWorker worker
* Enable Feeds::Import for single user feed fetching behind a feature flag
* Add Feeds::ValidateUrl service
* Add feature flag to user's validate feed URL feature
* Remove todo notices
* Add feature flag to fetch_all_rss task
* Add feature flag to RssReaderWorker
* Bring back short-circuit for Articles::RssReaderWorker
* Add the parallel gem
* Add prototype version of Feeds::Import with parallel URL fetching and parsing
* Tune Feeds::Import and add rake task for local tests
* Add rough measurer tool
* Add specs
* Apply suggestions by @citizen428
* Replace silence with silent
* No need for eager loading
* Add temporary Articles::DevFeedsImportWorker
* Remove temporary rake task
* Add basic error handling, copied from RssReader
* Fix error handling
* Remove temporary measuring rake task
* Remove logging added for development purposes
* Add info and error logging on error level
* Only bust_fastly_cache if fastly is enabled
* Conditionally bust nginx cache from CacheBuster#bust
* Don't _actually_ call out to openresty
* Remove redundant check for FASTLY_API_KEY in CacheBuster
* Clean up and add a spec
* Do not call .purge_ methods if fastly is not configured
* Add OPENRESTY_ ENV vars to .env_sample
* Remove extra / prepending path
* Remove ConfigurationError, clean up Purgeable concern
* Use raise instead of fail like fastly-ruby
* No longer check for Rails.env.production?
* Use let! to create article in BustMultipleCachesWorker spec
* Add new UpdateMainImageBackgroundHexWorker worker class
This is a port of app/jobs/update_main_image_background_job.rb
that works with Sidekiq instead of DelayedJob.
* Update all references to UpdateMainImageBackgroundHexJob
This updates all references to UpdateMainImageBackgroundHexJob
so they now call UpdateMainImageBackgroundHexWorker, which works
with Sidekiq instead of DelayedJob.
* Move method call to after_commit callback
* Fix article specs with sidekiq helpers
Co-authored-by: Alex <alexandersmith223@gmail.com>
* Create Articles::ScoreCalcWorker
* Create Articles::ScoreCalcWorker spec
* Update references to the new ScoreCalcWorker
* Refactoring conditional callbacks and biz logic
- Move update_columns to a model method
- Move conditions on callback to guard clause in callback method
- Make article_destroy_spec more explicit
Related to: #5305
In order to move all the jobs to Sidekiq, this commit creates a new
Articles/BustMultipleCachesWorker using Sidekiq based on the
Articles/BustMultipleCachesJob (this one is not removed until we know
that any job on this one will be performed).