Add sentry videoId information to pubsub webhook.

This commit is contained in:
Kavin 2023-06-05 23:44:05 +01:00
parent afc109f408
commit b9f8fc99f5
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD

View File

@ -10,6 +10,7 @@ import io.activej.inject.annotation.Provides;
import io.activej.inject.module.AbstractModule; import io.activej.inject.module.AbstractModule;
import io.activej.inject.module.Module; import io.activej.inject.module.Module;
import io.activej.launchers.http.MultithreadedHttpServerLauncher; import io.activej.launchers.http.MultithreadedHttpServerLauncher;
import io.sentry.Sentry;
import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import me.kavin.piped.consts.Constants; import me.kavin.piped.consts.Constants;
import me.kavin.piped.server.handlers.*; import me.kavin.piped.server.handlers.*;
@ -87,12 +88,14 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher {
Multithreading.runAsync(() -> { Multithreading.runAsync(() -> {
for (var entry : feed.getEntries()) { for (var entry : feed.getEntries()) {
String url = entry.getLinks().get(0).getHref(); String url = entry.getLinks().get(0).getHref();
String videoId = StringUtils.substring(url, -11);
try (StatelessSession s = DatabaseSessionFactory.createStatelessSession()) { try (StatelessSession s = DatabaseSessionFactory.createStatelessSession()) {
if (DatabaseHelper.doesVideoExist(s, StringUtils.substring(url, -11))) if (DatabaseHelper.doesVideoExist(s, videoId))
continue; continue;
} }
Multithreading.runAsync(() -> { Multithreading.runAsync(() -> {
try { try {
Sentry.setExtra("videoId", videoId);
StreamInfo info = StreamInfo.getInfo(url); StreamInfo info = StreamInfo.getInfo(url);
Multithreading.runAsync(() -> { Multithreading.runAsync(() -> {