MadelineProto icon indicating copy to clipboard operation
MadelineProto copied to clipboard

Cancel getUpdates

Open shinovon opened this issue 4 months ago • 3 comments

Can you add function for cancelling getUpdates? e.g:

--- src/MTProtoTools/UpdateHandler.php
+++ src/MTProtoTools/UpdateHandler.php
@@ -384,6 +384,17 @@ trait UpdateHandler
             }
         }
     }
+	public function cancelGetUpdates(): bool
+	{
+		if (!$this->usingGetUpdates || !$this->update_deferred) {
+			return false;
+		}
+		
+		$deferred = $this->update_deferred;
+		$this->update_deferred = null;
+		$deferred->error(new \Exception("cancel"));
+		return true;
+	}
     /**
      * Check message ID.
      *

shinovon avatar Jul 28 '25 10:07 shinovon

This is caused by a server-side issue, the layer was rollbacked to 207 in MadelineProto 8.5.3 to avoid it until it is fixed by the devs.

danog avatar Jul 29 '25 11:07 danog

I didn't mean to report any bug or issue, it's feature request to get ability to cancel $MP->getUpdates() function without having to wait timeout

shinovon avatar Jul 29 '25 12:07 shinovon

Aha,

danog avatar Jul 29 '25 12:07 danog