This small change fixes a bug that would fail to run tasks that have require_enrichment, and the entity type has more than 1 enrichment tasks. Although the changes to the entity are handled in a transaction, for some reason, the variable @entity would not get updated if another task sets @entity.enrichment_tasks_completed = etc(line 219 - 226 in lib/tasks/base.rb). Therefore, the condition in line 229 in file lib/tasks/base.rb would never fulfil:
As a result, the entity is never marked fully enriched, and any tasks that have require_enrichment fail to run.
The solution was to reload the @entity variable through Intrigue::Core::Model::Entity.find. There may be better ways, but this one definitely solves the problem.
This small change fixes a bug that would fail to run tasks that have
require_enrichment
, and the entity type has more than 1 enrichment tasks. Although the changes to the entity are handled in a transaction, for some reason, the variable@entity
would not get updated if another task sets@entity.enrichment_tasks_completed = etc
(line 219 - 226 in lib/tasks/base.rb). Therefore, the condition in line 229 in file lib/tasks/base.rb would never fulfil:As a result, the entity is never marked fully enriched, and any tasks that have
require_enrichment
fail to run.The solution was to reload the
@entity
variable throughIntrigue::Core::Model::Entity.find
. There may be better ways, but this one definitely solves the problem.