我下面的答案here的建議,並已證實:tailcall_optimization =>真實:trace_instruction =>假的,但我仍然得到:即使遞歸調用在函數結束時堆棧級別太深?
SystemStackError: stack level too deep
...
... 8696 levels...
我在做什麼錯?
def persist_shipments_then_next(prev_data)
persist_shipments(prev_data)
next_token = prev_data['NextToken']
puts next_token
unless next_token.nil?
next_data = @client.list_inbound_shipments_by_next_token(
next_token
).parse
persist_shipments_then_next(next_data)
end
end
更新:我刪除從application.rb中以下和它的作品WTF?:
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
}
http://www.rubyappcare.com/blog/2016- 09-01-debugging-stack-level-too-deep-error-on-rails希望這將有助於弄清楚錯誤的確切原因。 –
選中此項:http://nithinbekal.com/posts/ruby-tco/。我認爲是'tailcall_optimizer'是什麼導致問題 –