内部循环似乎运行良好,但是外部循环超过了500个限制。为什么会这样?
Given("I save all emails") do
emails = 0
i = 1
until emails == 500
until i == 120
fetch_emails(i, emails)
i += 1
end
click_next_button
emails += 120
puts emails
i = 1
puts i
end
end
答案 0 :(得分:3)
您的条件是$recentPostQuery = Post::select('created_at')
->whereColumn('firebase_id', 'users.firebase_id')
->latest()
->limit(1)
->getQuery();
User::select('users.*')
->selectSub($recentPostQuery, 'recent_post_date')
->whereHas('posts', function ($q) {
$q->withCount('comments');
})
->with(['posts' => function ($q) {
$q->withCount('comments')
->orderBy('created_at', 'ASC');
}])
->orderBy('recent_post_date', 'DESC')
->get();
。这意味着任何大于500的数字都将继续循环。但是,您要实现的是emails == 500