examine: Move price lookups off executor
Historically price lookup was done by sending a web request on price
lookups, which required calls to be done on an executor. As of
a1ae397e11, client prices are loaded periodically and cached, thus no
longer imposing any thread requirement on price lookup.
This commit is contained in:
@@ -29,7 +29,6 @@ import com.google.common.cache.CacheBuilder;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -92,9 +91,6 @@ public class ExaminePlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ChatMessageManager chatMessageManager;
|
private ChatMessageManager chatMessageManager;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ScheduledExecutorService executor;
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameStateChanged(GameStateChanged event)
|
public void onGameStateChanged(GameStateChanged event)
|
||||||
{
|
{
|
||||||
@@ -219,7 +215,7 @@ public class ExaminePlugin extends Plugin
|
|||||||
if (itemComposition != null)
|
if (itemComposition != null)
|
||||||
{
|
{
|
||||||
final int id = itemManager.canonicalize(itemComposition.getId());
|
final int id = itemManager.canonicalize(itemComposition.getId());
|
||||||
executor.submit(() -> getItemPrice(id, itemComposition, itemQuantity));
|
getItemPrice(id, itemComposition, itemQuantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.examine;
|
|||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.testing.fieldbinder.Bind;
|
import com.google.inject.testing.fieldbinder.Bind;
|
||||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -73,10 +72,6 @@ public class ExaminePluginTest
|
|||||||
@Bind
|
@Bind
|
||||||
ItemManager itemManager;
|
ItemManager itemManager;
|
||||||
|
|
||||||
@Mock
|
|
||||||
@Bind
|
|
||||||
ScheduledExecutorService scheduledExecutorService;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user