Skip to content

Commit

Permalink
Performance tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinmilewski93 committed Jul 15, 2024
1 parent 52c3124 commit 3608333
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private ScenarioRuntime initRuntime(Feature feature, Map<String, Object> args) {
private static final String ALLOWED_METHODS = "GET, HEAD, POST, PUT, DELETE, PATCH";

@Override
public synchronized Response handle(Request req) { // note the [synchronized]
public Response handle(Request req) {
if (corsEnabled && "OPTIONS".equals(req.getMethod())) {
Response response = new Response(200);
response.setHeader("Allow", ALLOWED_METHODS);
Expand All @@ -170,6 +170,9 @@ public synchronized Response handle(Request req) { // note the [synchronized]
// snapshot existing thread-local to restore
ScenarioEngine prevEngine = ScenarioEngine.get();
for (Map.Entry<Feature, ScenarioRuntime> entry : scenarioRuntimes.entrySet()) {
if (!entry.getKey().getName().startsWith(req.getPath().split("/")[1])){
continue;
}
Feature feature = entry.getKey();
ScenarioRuntime runtime = entry.getValue();
// important for graal to work properly
Expand Down

0 comments on commit 3608333

Please # to comment.