Skip to content

OBGM-386 Move recall logic to service layer#4116

Merged
awalkowiak merged 3 commits intofeature/upgrade-to-grails-3.3.10from
OBGM-386
Jun 26, 2023
Merged

OBGM-386 Move recall logic to service layer#4116
awalkowiak merged 3 commits intofeature/upgrade-to-grails-3.3.10from
OBGM-386

Conversation

@awalkowiak
Copy link
Collaborator

To fix issue with not having data from not yet finished session while refreshing product availability for all locations after recall or revert recall

import java.text.DateFormat
import java.text.SimpleDateFormat

@Transactional
Copy link
Collaborator

@kchelstowski kchelstowski Jun 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On one hand there is probably no other way to make this work, but on the other hand I'm afraid of that this change considering the other methods, especially the saving ones, that do not use the flush, won't work.

With the setting allow_update_outside_transaction we will only auto-commit the change (which is also not good) if we use the flush (this is probably why you've added flush: true to the create method).

I would also be aware of the InventoryItem publishPersistenceEvent - without transaction and with auto-commit (flush: true on update) we might face some weird exceptions when the afterUpdate would be executed. Have you made sure those work?

I think the best idea (and the "cleanest" one) would be just to live with the exceptions that might be thrown, create tickets and move the other methods to the service layer (or temporarily add @transactional to the "risk" methods one by one with a TODO to move this to the service....)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kchelstowski In case I hadn't mentioned it before it would be great to explore this as part of OBGM-515. If that's too much, we should be adding color to that ticket so we can create other spike tickets to explore specific things we do not yet know about how things within Hibernate work. The @transactional annotation on controllers would be a very good topic to explore on its own.

@awalkowiak awalkowiak added the warn: do not merge Marks a pull request that is not yet ready to be merged label Jun 20, 2023
To fix issue with not having data from not yet finished session while refreshing product availability for all locations after recall or revert recall
@awalkowiak awalkowiak removed the warn: do not merge Marks a pull request that is not yet ready to be merged label Jun 21, 2023
@awalkowiak
Copy link
Collaborator Author

@kchelstowski @jmiranda this one can be re-reviewed

@awalkowiak awalkowiak merged commit b6d4436 into feature/upgrade-to-grails-3.3.10 Jun 26, 2023
@awalkowiak awalkowiak deleted the OBGM-386 branch June 26, 2023 13:21
Copy link
Member

@jmiranda jmiranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. See comment for tech-huddle topic.

}
}

void recallInventoryItem(InventoryItem inventoryItem) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how massive the InventoryService class is we should be thinking longer term about how to refactor this into smaller classes.

I think the obvious options are

  • Domain (Product, Inventory, InventoryItem) which we used and caused this mess
  • Functional area (transfer vs movement vs recall) which seems way better but might have some overlap that we need to contend with
  • Other suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants