[
https://issues.apache.org/jira/browse/TINKERPOP-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17249592#comment-17249592
]
ASF GitHub Bot commented on TINKERPOP-2438:
-------------------------------------------
spmallette commented on a change in pull request #1371:
URL: https://github.com/apache/tinkerpop/pull/1371#discussion_r543198511
##########
File path:
gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinScriptChecker.java
##########
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Processes Gremlin strings using regex so as to try to detect certain
properties from the script without actual
+ * having to execute a {@code eval()} on it.
+ */
+public class GremlinScriptChecker {
+
+ public static final Result EMPTY_RESULT = new Result(0);
+ private static final List<String> tokens =
Arrays.asList("evaluationTimeout", "scriptEvaluationTimeout",
+
"ARGS_EVAL_TIMEOUT", "ARGS_SCRIPT_EVAL_TIMEOUT");
+
+ private static final Pattern patternClean =
Pattern.compile("//.*$|/\\*(.|[\\r\\n])*?\\*/|\\s", Pattern.MULTILINE);
Review comment:
Interesting - the tool I've always used didn't produce that nice explain
stuff. I didn't realize that such a thing existed. 👍
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Provide a way for scripts to respect with() specification of timeout
> --------------------------------------------------------------------
>
> Key: TINKERPOP-2438
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2438
> Project: TinkerPop
> Issue Type: Improvement
> Components: server
> Affects Versions: 3.4.8
> Reporter: Stephen Mallette
> Assignee: Stephen Mallette
> Priority: Major
> Fix For: 3.5.0, 3.4.9
>
>
> This issue sorta relates to the Gremlin Console but I think it's generally a
> server side problem as it could easily occur with HTTP or just scripts sent
> over web sockets. Folks tend to see all the ways they can set timeouts and
> then mix/match them. It only remains a problem with sending a script as
> {{g.with("evalTimeout",100)}} because the server won't know that this value
> was set until the script is passed to {{eval()}} but by then it's too late
> because we would have already started the timeout countdown. While most
> users wouldn't send that as a bare script submission it's a common mistake in
> the Gremlin Console and similar environments where it is not clear you are
> working with a remote graph.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)