工作异常:Holidays::InvalidRegion

I’m new at Discourse troubleshooting, so I’m not sure where to start on this.

This started a month or so ago. I’m now at 4347 instances of Job exception: Holidays::InvalidRegion.

/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/parse_options.rb:83:in `block in validate!'
/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/parse_options.rb:82:in `each'
/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/parse_options.rb:82:in `validate!'
/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/parse_options.rb:41:in `parse_regions!'
/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/parse_options.rb:20:in `call'
/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays/finder/context/between.rb:14:in `call'
/var/www/discourse/plugins/discourse-calendar/vendor/holidays/lib/holidays.rb:49:in `between'
/var/www/discourse/plugins/discourse-calendar/app/services/discourse_calendar/holiday.rb:14:in `find_holidays_for'
/var/www/discourse/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rb:68:in `block in execute'
/var/www/discourse/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rb:66:in `each'
/var/www/discourse/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rb:66:in `execute'
/var/www/discourse/app/jobs/base.rb:318:in `block (2 levels) in perform'
rails_multisite-7.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-7.0.0/lib/rails_multisite/connection_management.rb:17:in `with_connection'
/var/www/discourse/app/jobs/base.rb:305:in `block in perform'
/var/www/discourse/app/jobs/base.rb:301:in `each'
/var/www/discourse/app/jobs/base.rb:301:in `perform'
/var/www/discourse/app/jobs/base.rb:381:in `perform'
mini_scheduler-0.18.0/lib/mini_scheduler/manager.rb:137:in `process_queue'
mini_scheduler-0.18.0/lib/mini_scheduler/manager.rb:77:in `worker_loop'
mini_scheduler-0.18.0/lib/mini_scheduler/manager.rb:63:in `block (2 levels) in ensure_worker_threads'

env

hostname	discourse-app
process_id	3072273
application_version	66f53ac5b9c7fdcd53868ccabac310b13ffc8910
current_db	default
current_hostname	discourse.------------.net
job	DiscourseCalendar::CreateHolidayEvents
problem_db	default
time	2:53 pm
	
opts	

We haven’t modified the discourse-calendar plugin.

Can someone start to point me in the right direction?

This is likely due to a recent update to the holiday definitions, which may have caused the generated region list to change without updating users’ existing Calendar Region preferences.

The error occurs for users who previously selected one of the now-removed regions as their Calendar Region.

You’re seeing that many instances of the exception because the scheduled job that triggers this runs every 10 minutes.

We’ll need to handle this more gracefully, by accounting for holiday definition updates that remove regions from the generated region list.

1 个赞

Interesting! I can say that our user base is exceptionally international, so that may track.

Am I correct to assume that 1) there is nothing I can do about this and 2) it doesn’t really matter much? Or do I need to make a bug report?

Thanks

I’ve moved this topic to Bug, so there’s no need to make another report.

Since we haven’t actually removed any major regions here, I suspect the issue is related to state- or territory-level region definitions similar to what you see below for the US:

The change most likely happened between these two commits

That depends on your comfort level with poking around the internals. You’ll need to:

  1. Identify users who have a Calendar Region preference set.
  2. Check which of those values are not in the current list of valid regions:
    REGIONS.rb
  3. Update those users’ region preferences to a valid top-level region. For example, a preference setting like United States (us_id) should become United States

It does if your site uses holiday calendar events. For affected users, no holiday events will be generated until their Calendar Region is fixed.

1 个赞