Skip to content

Commit d85c02c

Browse files
committed
handle errors while getting syncing live channels
1 parent b2f2892 commit d85c02c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/main/java/vc/live/LiveFeed.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,20 @@ private void queueHealthCheck() {
149149

150150
public void syncChannels() {
151151
liveChannels.clear();
152-
guildConfigManager.getAllGuildConfigs().stream()
153-
.filter(this::channelEnabledPredicate)
154-
.forEach(config -> liveChannels.put(config.guildId(), discordClient
155-
.getChannelById(Snowflake.of(liveChannelId(config)))
156-
.map(Channel::getRestChannel)
157-
.block()));
152+
var allConfigs = guildConfigManager.getAllGuildConfigs();
153+
for (var config : allConfigs) {
154+
if (!channelEnabledPredicate(config)) continue;
155+
try {
156+
var channel = discordClient
157+
.getChannelById(Snowflake.of(liveChannelId(config)))
158+
.map(Channel::getRestChannel)
159+
.block();
160+
liveChannels.put(config.guildId(), channel);
161+
} catch (final Exception e) {
162+
LOGGER.error("Error getting channel: {} for guild: {}", liveChannelId(config), config.guildId(), e);
163+
// disableFeed(config.guildId());
164+
}
165+
}
158166
}
159167

160168
public void disableFeed(final String guildId) {

0 commit comments

Comments
 (0)