From 3839bf95861d56351b5af5dcb0dbbdde9898b890 Mon Sep 17 00:00:00 2001 From: Toru the Red Fox Date: Thu, 19 Oct 2023 17:52:59 +0100 Subject: [PATCH] another adjustment for timeouts --- Discord Classic/DCChannel.m | 10 +++++----- Discord Classic/DCMessage.m | 2 +- Discord Classic/DCTools.m | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Discord Classic/DCChannel.m b/Discord Classic/DCChannel.m index e653693..27e471c 100755 --- a/Discord Classic/DCChannel.m +++ b/Discord Classic/DCChannel.m @@ -37,7 +37,7 @@ - (void)sendMessage:(NSString*)message { dispatch_async(apiQueue, ^{ NSURL* channelURL = [NSURL URLWithString: [NSString stringWithFormat:@"https://discordapp.com/api/channels/%@/messages", self.snowflake]]; - NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20]; + NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:40]; NSString* escapedMessage = [message mutableCopy]; @@ -73,7 +73,7 @@ - (void)sendImage:(UIImage*)image { dispatch_async(apiQueue, ^{ NSURL* channelURL = [NSURL URLWithString: [NSString stringWithFormat:@"https://discordapp.com/api/channels/%@/messages", self.snowflake]]; - NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:40]; + NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60]; [urlRequest setHTTPMethod:@"POST"]; @@ -112,7 +112,7 @@ - (void)sendTypingIndicator{ dispatch_async(apiQueue, ^{ NSURL* channelURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://discordapp.com/api/channels/%@/typing", self.snowflake]]; - NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:2]; + NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5]; // low timeout to avoid API spam [urlRequest setHTTPMethod:@"POST"]; @@ -137,7 +137,7 @@ - (void)ackMessage:(NSString*)messageId{ dispatch_async(apiQueue, ^{ NSURL* channelURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://discordapp.com/api/channels/%@/messages/%@/ack", self.snowflake, messageId]]; - NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5]; + NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:channelURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10]; [urlRequest setHTTPMethod:@"POST"]; @@ -171,7 +171,7 @@ - (NSArray*)getMessages:(int)numberOfMessages beforeMessage:(DCMessage*)message{ if(message) [getChannelAddress appendString:[NSString stringWithFormat:@"before=%@", message.snowflake]]; - NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:getChannelAddress] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20]; + NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:getChannelAddress] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:40]; [urlRequest addValue:DCServerCommunicator.sharedInstance.token forHTTPHeaderField:@"Authorization"]; [urlRequest addValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; diff --git a/Discord Classic/DCMessage.m b/Discord Classic/DCMessage.m index 4f210db..49ea3ee 100755 --- a/Discord Classic/DCMessage.m +++ b/Discord Classic/DCMessage.m @@ -17,7 +17,7 @@ - (void)deleteMessage{ dispatch_async(apiQueue, ^{ NSURL* messageURL = [NSURL URLWithString: [NSString stringWithFormat:@"https://discordapp.com/api/v6/channels/%@/messages/%@", DCServerCommunicator.sharedInstance.selectedChannel.snowflake, self.snowflake]]; - NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:messageURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10]; + NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:messageURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:40]; [urlRequest setHTTPMethod:@"DELETE"]; diff --git a/Discord Classic/DCTools.m b/Discord Classic/DCTools.m index 601925e..cf4ddac 100755 --- a/Discord Classic/DCTools.m +++ b/Discord Classic/DCTools.m @@ -414,7 +414,7 @@ + (void)joinGuild:(NSString*)inviteCode { //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ NSURL* guildURL = [NSURL URLWithString: [NSString stringWithFormat:@"https://discordapp.com/api/v6/invite/%@", inviteCode]]; - NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:guildURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20]; + NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:guildURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:40]; [urlRequest setHTTPMethod:@"POST"];