Skip to content

Slow PDF Downloads #41

Description

@TheOnlyWayUp

It took 11 minutes to build the PDF for this Story
https://www.wattpad.com/story/356235161

Generated PDF - https://files.rambhat.la/s/RpdiE4PAX26yqEM

Logs:

{"story_id":356235161,"action_status":"started","timestamp":1735974783.4149618,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_story","task_level":[2,1]}
{"action_status":"succeeded","timestamp":1735974783.7689843,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_story","task_level":[2,2]}
{"url":"https://img.wattpad.com/cover/356235161-512-k358770.jpg","action_status":"started","timestamp":1735974783.7693708,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_image","task_level":[3,1]}
{"action_status":"succeeded","timestamp":1735974785.834231,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_image","task_level":[3,2]}
{"log_level":"INFO","logger":"wpd","message":"Retrieved story metadata and cover (story_id=356235161)","timestamp":1735974785.8445904,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","task_level":[4],"message_type":"eliot:stdlib"}
{"story_id":356235161,"action_status":"started","timestamp":1735974785.8447442,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_storyZip","task_level":[5,1]}
{"action_status":"succeeded","timestamp":1735974793.2555006,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_storyZip","task_level":[5,2]}
{"url":"https://img.wattpad.com/useravatar/Hyemi07.512.552780.jpg","action_status":"started","timestamp":1735974796.7039616,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_image","task_level":[6,1]}
{"action_status":"succeeded","timestamp":1735974798.262608,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"api_fetch_image","task_level":[6,2]}
{"output_filename":"/tmp/tmp_3kgb18_.pdf","title":"Bayik Tiran","action_status":"started","timestamp":1735974798.3124168,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"generate_pdf","task_level":[7,1]}
{"action_status":"succeeded","timestamp":1735975483.0221803,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"generate_pdf","task_level":[7,2]}
{"action_status":"started","timestamp":1735975483.0223053,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"add_metadata","task_level":[8,1]}
{"timestamp":1735975483.022351,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","task_level":[8,2],"message_type":"clean_description: Bayik Mabel $/$/-Tolong Jangan di repost!"}
{"timestamp":1735975483.0224016,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","task_level":[8,3],"message_type":"options: {'Author': 'Hyemi07', 'Title': 'Bayik Tiran', 'Subject': 'Bayik Mabel $/$/-Tolong Jangan di repost!', 'CreationDate': '2023-11-15T07:27:03Z', 'ModDate': '2024-11-29T08:03:20Z', 'Keywords': 'aidan,mabel,novelkorea,novelterjemahan', 'Language': 'Bahasa Indonesia', 'Completed': False, 'MatureContent': False, 'Producer': 'Dhanush Rambhatla (TheOnlyWayUp - https://rambhat.la) and WattpadDownloader'}"}
{"action_status":"succeeded","timestamp":1735975485.2488766,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"add_metadata","task_level":[8,4]}
{"action_status":"succeeded","timestamp":1735975485.2962654,"task_uuid":"45892946-8a63-4be7-ae3c-f4dd253bec17","action_type":"download","task_level":[9]}

Parsed, that's about,

  1. api_fetch_story - 350ms
  2. api_fetch_image (Cover) - 2.07s
  3. api_fetch_storyZip - 7.41s
  4. api_fetch_image (Author Avatar) - 1.56s
  5. generate_pdf - 11m 25s
  6. add_metadata - 2.23s
  7. download - 47ms

Weasyprint is known for being slow, I'm not sure if there's anything we can really do about this.

On the hosted instance, behind CF, it leads to Timeout errors.
image

Downloads, though slow, are fully processed on self-hosted or non-CF instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions