Skip to content

Package model: update_composer_cache callback not working properly

Summary

The callback access the composer_metadatum but it can be nil.

See the kibana logs: https://log.gprd.gitlab.net/goto/77bb770990f47587012129c74b6c4dc1 (internal)

Details

I think that because the callback is on an after_commit callback that is specific for #destroy, this will not work reliably because by the time we access composer_metadatum, the package model has already been deleted and the delete has already been cascaded to composer_metadatum = there is no row = nil is returned.

Proposal

Remove the #update_composer_cache method and its corresponding callback from the package model. This is safe because:

  1. This callback has never worked and has always resulted in this error.
  2. Based on the investigation in this thread, the cache files are not being used, so we do not need to worry about updating them upon composer package deletion.
Edited by Tim Rizzi