Skip to content

Commit

Permalink
Always saves notification for user
Browse files Browse the repository at this point in the history
  • Loading branch information
Fagorym committed Nov 7, 2023
1 parent 62bc2c6 commit 2db2857
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ public class NotificationServiceImpl implements NotificationService {
@Override
public void handleOrderNotification(OrderNotificationEvent event) {
User user = userRepository.findById(event.userId()).orElseThrow();
if (user.getVkUserId() != null) {
try {
try {
if (user.getVkUserId() != null) {
vkApi.sendNotification(
new RequestVkNotification(event.message(), vkServiceKey, String.valueOf(user.getVkUserId()))
);
} catch (Exception e) {
saveNotification(event, user);
log.error(e.getMessage());
}
} else {
} catch (Exception e) {
log.error(e.getMessage());
} finally {
saveNotification(event, user);
}
}
Expand Down

0 comments on commit 2db2857

Please sign in to comment.