mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
[bug] AvailabilityIndexerWorker crash availabilities deleted just after their creation
This commit is contained in:
parent
ce7b737163
commit
b5246ae1cf
@ -10,6 +10,7 @@
|
|||||||
- Fix a bug: unable to compute user's age when they were born on february 29th and current year is not a leap year
|
- Fix a bug: unable to compute user's age when they were born on february 29th and current year is not a leap year
|
||||||
- Fix a bug: wrong statistics about hours available for machines reservation. Fix requires user action (1)
|
- Fix a bug: wrong statistics about hours available for machines reservation. Fix requires user action (1)
|
||||||
- Fix a bug: when regenerating statistics, previous values are not fully removed (only 10 firsts), resulting in wrong statistics generation
|
- Fix a bug: when regenerating statistics, previous values are not fully removed (only 10 firsts), resulting in wrong statistics generation
|
||||||
|
- Fix a bug: when deleting an availability just after its creation, the indexer workers crash and retries for a month
|
||||||
- [TODO DEPLOY] remove possible value `application/` in `ALLOWED_MIME_TYPES` list, in environment variable
|
- [TODO DEPLOY] remove possible value `application/` in `ALLOWED_MIME_TYPES` list, in environment variable
|
||||||
- [TODO DEPLOY] `rails runner StatisticCustomAggregation.destroy_all`, then `rake db:seed`, then `rake fablab:es_build_availabilities_index` (1)
|
- [TODO DEPLOY] `rails runner StatisticCustomAggregation.destroy_all`, then `rake db:seed`, then `rake fablab:es_build_availabilities_index` (1)
|
||||||
|
|
||||||
|
@ -10,11 +10,18 @@ class AvailabilityIndexerWorker
|
|||||||
|
|
||||||
case operation.to_s
|
case operation.to_s
|
||||||
when /index/
|
when /index/
|
||||||
record = Availability.find(record_id)
|
begin
|
||||||
Client.index index: Availability.index_name, type: Availability.document_type, id: record.id, body: record.as_indexed_json
|
record = Availability.find(record_id)
|
||||||
#puts record.as_indexed_json
|
Client.index index: Availability.index_name, type: Availability.document_type, id: record.id, body: record.as_indexed_json
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
STDERR.puts "Availability id(#{record_id}) will not be indexed in ElasticSearch as it does not exists anymore in database"
|
||||||
|
end
|
||||||
when /delete/
|
when /delete/
|
||||||
Client.delete index: Availability.index_name, type: Availability.document_type, id: record_id
|
begin
|
||||||
|
Client.delete index: Availability.index_name, type: Availability.document_type, id: record_id
|
||||||
|
rescue Elasticsearch::Transport::Transport::Errors::NotFound
|
||||||
|
STDERR.puts "Availability id(#{record_id}) will not be deleted form ElasticSearch as it has not been already indexed"
|
||||||
|
end
|
||||||
else raise ArgumentError, "Unknown operation '#{operation}'"
|
else raise ArgumentError, "Unknown operation '#{operation}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user