mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-26 05:44:42 +00:00
[AB-109] fixing streamers not being marked online if the post target is disabled
This commit is contained in:
@@ -400,23 +400,37 @@ public class StreamerServiceBean implements StreamerService {
|
|||||||
}
|
}
|
||||||
streamer.setCurrentGameId(stream.getGameId());
|
streamer.setCurrentGameId(stream.getGameId());
|
||||||
}
|
}
|
||||||
return;
|
} else if(currentSession == null &&
|
||||||
}
|
!postTargetService.postTargetUsableInServer(TwitchPostTarget.TWITCH_LIVE_NOTIFICATION, server.getId())) {
|
||||||
CompletableFutureList<Message> messages = notifyAboutOnlineStream(stream, streamer, streamerUser);
|
// this is the case in which the streamer is online, and we should in theory notify about the online status
|
||||||
messages.getMainFuture()
|
// _but_ the difference is that there is no current session on going - as the sessions in our database are
|
||||||
.thenAccept(unused -> {
|
// bound to actual notifications sent, and this is the case in which the post target has been disabled.
|
||||||
Message message = messages.getFutures().get(0).join();
|
// In this case we only update current game if necessary
|
||||||
if(message != null) {
|
// this only really serves as a shortcut to not evaluate and create a full MessageToSend object
|
||||||
|
// just to not actually send it
|
||||||
|
if(streamer.getCurrentGameId() == null || !streamer.getCurrentGameId().equals(stream.getGameId())) {
|
||||||
|
log.info("Game for streamer {} has changed - updating game.", streamerId);
|
||||||
|
streamer.setCurrentGameId(stream.getGameId());
|
||||||
|
}
|
||||||
|
streamer.setOnline(true);
|
||||||
|
streamerManagementService.saveStreamer(streamer);
|
||||||
|
} else {
|
||||||
|
CompletableFutureList<Message> messages = notifyAboutOnlineStream(stream, streamer, streamerUser);
|
||||||
|
messages.getMainFuture()
|
||||||
|
.thenAccept(unused -> {
|
||||||
|
Message message = messages.getFutures().get(0).join();
|
||||||
try {
|
try {
|
||||||
self.storeStreamNotificationMessage(message, streamerId, stream);
|
if(message != null) {
|
||||||
|
self.storeStreamNotificationMessage(message, streamerId, stream);
|
||||||
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
log.error("Failed to store stream notification message of streamer {}.", streamerId, exception);
|
log.error("Failed to update streamer {} in database.", streamerId, exception);
|
||||||
}
|
}
|
||||||
}
|
}).exceptionally(throwable -> {
|
||||||
}).exceptionally(throwable -> {
|
log.error("Failed to notify about online stream of streamer {}.", streamerId, throwable);
|
||||||
log.error("Failed to notify about online stream of streamer {}.", streamerId, throwable);
|
return null;
|
||||||
return null;
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
Reference in New Issue
Block a user