Merge pull request #617 from TeamPiped/videoid-sentry-newstream

Add sentry videoId information to pubsub webhook.
This commit is contained in:
Kavin 2023-06-05 23:51:53 +01:00 committed by GitHub
commit 35866cb953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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