Merge pull request #3428 from jplsek/enqueue

Enqueue most post/put/delete requests
This commit is contained in:
Adam
2018-05-28 17:17:00 -04:00
committed by GitHub
8 changed files with 117 additions and 101 deletions

View File

@@ -266,19 +266,7 @@ public class ConfigManager
if (client != null)
{
Runnable task = () ->
{
try
{
client.set(groupName + "." + key, value);
}
catch (IOException ex)
{
log.warn("unable to set configuration item", ex);
}
};
executor.execute(task);
client.set(groupName + "." + key, value);
}
Runnable task = () ->
@@ -316,19 +304,7 @@ public class ConfigManager
if (client != null)
{
final Runnable task = () ->
{
try
{
client.unset(groupName + "." + key);
}
catch (IOException ex)
{
log.warn("unable to set configuration item", ex);
}
};
executor.execute(task);
client.unset(groupName + "." + key);
}
Runnable task = () ->

View File

@@ -183,7 +183,7 @@ public class ExaminePlugin extends Plugin
}
cache.put(key, Boolean.TRUE);
executor.submit(() -> submitExamine(pendingExamine, event.getMessage()));
submitExamine(pendingExamine, event.getMessage());
}
private void findExamineItem(PendingExamine pendingExamine)
@@ -356,24 +356,17 @@ public class ExaminePlugin extends Plugin
{
int id = examine.getId();
try
switch (examine.getType())
{
switch (examine.getType())
{
case ITEM:
examineClient.submitItem(id, text);
break;
case OBJECT:
examineClient.submitObject(id, text);
break;
case NPC:
examineClient.submitNpc(id, text);
break;
}
}
catch (IOException ex)
{
log.warn("Error submitting examine", ex);
case ITEM:
examineClient.submitItem(id, text);
break;
case OBJECT:
examineClient.submitObject(id, text);
break;
case NPC:
examineClient.submitNpc(id, text);
break;
}
}

View File

@@ -32,7 +32,6 @@ import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.EnumSet;
import java.util.Objects;
import java.util.concurrent.ScheduledExecutorService;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
@@ -71,9 +70,6 @@ public class XpTrackerPlugin extends Plugin
@Inject
private SkillIconManager skillIconManager;
@Inject
private ScheduledExecutorService executor;
private NavigationButton navButton;
private XpPanel xpPanel;
@@ -164,19 +160,7 @@ public class XpTrackerPlugin extends Plugin
String username = local != null ? local.getName() : null;
if (username != null)
{
log.debug("Submitting xp track for {}", username);
executor.submit(() ->
{
try
{
xpClient.update(username);
}
catch (IOException ex)
{
log.warn("error submitting xp track", ex);
}
});
xpClient.update(username);
}
}
}

View File

@@ -25,10 +25,8 @@
package net.runelite.client.plugins.xtea;
import com.google.common.eventbus.Subscribe;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
@@ -36,7 +34,6 @@ import net.runelite.api.events.MapRegionChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.http.api.xtea.XteaClient;
import okhttp3.Response;
@PluginDescriptor(
name = "Xtea",
@@ -52,9 +49,6 @@ public class XteaPlugin extends Plugin
@Inject
private Client client;
@Inject
private ScheduledExecutorService executor;
@Subscribe
public void onMapRegionChanged(MapRegionChanged event)
{
@@ -82,19 +76,6 @@ public class XteaPlugin extends Plugin
sentRegions.add(region);
executor.execute(() ->
{
try (Response response = xteaClient.submit(revision, region, keys))
{
if (!response.isSuccessful())
{
log.debug("unsuccessful xtea response");
}
}
catch (IOException ex)
{
log.debug("unable to submit xtea keys", ex);
}
});
xteaClient.submit(revision, region, keys);
}
}