Closed tehraven closed 6 months ago
After updating an existing test environment to check out this change, it looks like this may break asset jobs currently due to data constraints. Asset jobs no longer seem to function and get stuck. Reverting to the previous version takes it back to a functional state. I'll certainly see if leaving it alone for a bit causes it to recover - but I have some doubts. Each time an asset job attempts to run the following stack trace is thrown.
`count(): Argument #1 ($value) must be of type Countable|array, stdClass given {"exception":"[object] (TypeError(code: 0): count(): Argument #1 ($value) must be of type Countable|array, stdClass given at /var/www/seat/vendor/softcreatr/jsonpath/src/Filters/SliceFilter.php:17) [stacktrace]
"}`
A little out of my world to try to understand why my PR caused this type of issue. @Crypta-Eve do you have any ideas?
The CharacterAssets and CorporationAssets jobs were made to delete all assets that were not "touched" by the execution of a assets job. The change that introduced this logic is here: https://github.com/eveseat/eveapi/pull/391/files#diff-8720b696b5950adb2e6a8cfe1a3b249b0d5bc0ef43abfed94eabff7d8927bd47L133-R124
The
->save()
call that occurs inside theassets->each()
call doesn't actually affect the updated_at column because the Model class from Laravel gaurds that operation withisDirty
checks -- The row in question has to actually be different then the DB value, else it won't perform the operation at all.Due to this, every iteration of the Character/Corporation Assets job deletes all assets that were not actually changed in this iteration. Example: You have 5 items. First run, it adds 5 rows. Before the second run, you add a 6th item to your inventory in-game. After that run, one new record is added, and the preexisting 5 rows will not have their updated_at columns updated, so they will be deleted. The third run will then find 5 new assets, and purge the 6th because it wasn't changed. Your runs will now flip-flop between 1 and 5 assets.
I expected the jobs to run, find all assets, and purge assets no longer returned by the ESI
SEAT v5 https://github.com/recursivetree/eveapi/blob/5.0.x/src/Jobs/Assets/Character/Assets.php#L113