Skip to content

Retrieve customer custom attribute from customer http_context or CustomerRepositoryInterface?

I am working on a function used in a observer where I need to have retrieve 4 values from customer custom attributes. Because the function is called when a customer is logged in, I can populate the attribute values in the customer session and retrieve them form this session.
Or I can retrieve them from the CustomerRepositoryInterface with the customer entity Id.

What would be the best option for performance and best practice?