如何使用 aws neptune 的 gremlin 查询设置查询超时?

How do I set the query timeout using gremlin query for aws neptune?

我尝试使用 g.with_('evaluationTimeout', 1) 之类的东西,但它似乎不起作用

假设您使用的是 Gremlin GLV 客户端之一,那么这样的查询(Python 在这种情况下)将应用每个查询超时。请注意,较长的形式 scriptEvaluationTimeout 已被弃用,取而代之的是较短的形式 evaluationTimeout

g.with_('scriptEvaluationTimeout',5).V().count().next()

g.with_('evaluationTimeout',5).V().count().next()

如果查询超时,您将收到异常消息,例如:

gremlin_python.driver.protocol.GremlinServerError: 500: 
{"detailedMessage":"A timeout occurred within the script during evaluation.","code":"TimeLimitExceededException","requestId":"9ec1e462-f47f-4876-8157-c0bf3c06ec6b"}