@@ -211,16 +211,20 @@ async function scheduleDeleteAccountContent() {
211211function scheduleDeleteMessages ( ) {
212212 setInterval ( async ( ) => {
213213 const details = await prisma . scheduleMessageDelete . findFirst ( ) ;
214+ Log . debug ( 'scheduleDeleteMessages tick' , { details } ) ;
214215 if ( ! details ) return ;
215216 if ( ! details . deletingAttachments && ! details . deletingMessages ) {
217+ Log . debug ( 'scheduleDeleteMessages removing empty schedule entry' , { channelId : details . channelId } ) ;
216218 await prisma . scheduleMessageDelete . delete ( {
217219 where : { channelId : details . channelId } ,
218220 } ) ;
219221 return ;
220222 }
221223
222224 if ( details . deletingAttachments ) {
225+ Log . debug ( 'scheduleDeleteMessages deleting attachments' , { channelId : details . channelId } ) ;
223226 const [ count , err ] = await deleteChannelAttachmentBatch ( details . channelId ) ;
227+ Log . debug ( 'scheduleDeleteMessages deleteChannelAttachmentBatch result' , { channelId : details . channelId , count, err } ) ;
224228 console . log ( count , err )
225229
226230 if ( err ?. type && err . type !== 'INVALID_PATH' ) {
@@ -240,6 +244,8 @@ function scheduleDeleteMessages() {
240244
241245 if ( ! details . deletingMessages ) return ;
242246
247+ Log . debug ( 'scheduleDeleteMessages deleting messages' , { channelId : details . channelId } ) ;
248+
243249 const deletedCount = await prisma . $executeRaw `
244250 DELETE FROM "messages"
245251 WHERE id IN
@@ -250,6 +256,7 @@ function scheduleDeleteMessages() {
250256 LIMIT 300
251257 );
252258 ` ;
259+ Log . debug ( 'scheduleDeleteMessages messages deleted' , { channelId : details . channelId , deletedCount } ) ;
253260 if ( deletedCount < 300 ) {
254261 await prisma . $transaction ( [
255262 prisma . scheduleMessageDelete . update ( {
0 commit comments