fix: a long film's print file gets a render limit per 15 m part
Order #20 (23.6 m, 24 pieces) failed with "Falhou ao gerar": the whole film had one 15 min limit, and two parts at 300 DPI take longer on the server. The limit is now PRINT_RENDER_TIMEOUT_SECONDS (default 20 min) for each part, and each claim records its deadline, so the stale-claim check and the card's "Tempo limite" follow the same limit. A timeout, or a final failed attempt, is logged as an error so Sentry sees it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,5 +38,20 @@ class ProofCutTests(unittest.TestCase):
|
||||
self.assertEqual(proof_cut(100, 15, None), [Decimal(0), Decimal(15)])
|
||||
|
||||
|
||||
class RenderLimitTests(unittest.TestCase):
|
||||
"""Order #20 (2026-11-12): a 23.6 m film ran past one 15 min limit."""
|
||||
|
||||
def test_the_limit_grows_with_the_parts(self):
|
||||
from app.printjobs import RENDER_SECONDS, render_seconds
|
||||
|
||||
def film(height):
|
||||
return {'production': {'height_cm': height, 'placements': [
|
||||
{'y_cm': 0, 'length_cm': height, 'source_index': 0}]}}
|
||||
self.assertEqual(render_seconds(film(800)), RENDER_SECONDS)
|
||||
self.assertEqual(render_seconds(film(2359.2)), 2 * RENDER_SECONDS)
|
||||
self.assertEqual(render_seconds(film(4600)), 4 * RENDER_SECONDS)
|
||||
self.assertEqual(render_seconds({'mode': 'file'}), RENDER_SECONDS)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user