Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving contest page fails if contest page too big #19

Open
jhsoby opened this issue Sep 5, 2024 · 9 comments
Open

Saving contest page fails if contest page too big #19

jhsoby opened this issue Sep 5, 2024 · 9 comments

Comments

@jhsoby
Copy link
Member

jhsoby commented Sep 5, 2024

If the contest page is too big (roughly >2 MB), it will fail to save, and the bot grinds to a halt.

Proposed solution: Make a check for this error; if the error (contenttoobig) happens, set a config flag for the current contest (how?) so that tooltip_text in https://github.com/danmichaelo/UKBot/blob/3e658f5e0bce8fae0da45df3885f847989f086df/ukbot/contributions.py#L316 (which can be relatively huge) is turned into something like "Calculation unavailable"), which should reduce the page size drastically.

@jcreusand
Copy link

jcreusand commented Feb 4, 2025

Another idea:
Have format in contributions.py save the text it generates in a subpage of the contest.

We would have a subpage for each participant, something like Contest root/contributions/Jack, Contest root/contributions/Jill, ...

Then, the contest page would just include each subpage, doing something like:

===  [[User:Jill|Jill]] (159 p) ===
5 articles, {{formatnum:33.83}} kB
{{:Contest root/contributions/Jill}}

===  [[User:Jack|Jack]] (139 p) ===
4 articles, {{formatnum:23.83}} kB
{{:Contest root/contributions/Jack}}

This way, we don't lose functionality, and we would hit the problem only if the contributions of one single user hit the 2MB mark.

@jcreusand
Copy link

Actually contenttoobig should still get checked, and if it happens, we should truncate the output as Jon suggests. If my idea gets implemented, that would affect only one user, though.

@jcreusand
Copy link

Another solution:
Have the bot save the results in a separate page: Contest root/Results

The contest page would have something like:

== Results ==
<!-- Begin:ResultsSection -->
{{:Contest root/Results}}
<!-- End:ResultsSection -->

If the results page grows over 2MB, then the bot should create a second results page (and a third one, if needed), and include them all in the contest page.

== Results ==
<!-- Begin:ResultsSection -->
{{:Contest root/Results}}
{{:Contest root/Results_1}}
<!-- End:ResultsSection -->

@jhsoby
Copy link
Member Author

jhsoby commented Feb 5, 2025

Another idea: Have format in contributions.py save the text it generates in a subpage of the contest.

We would have a subpage for each participant, something like Contest root/contributions/Jack, Contest root/contributions/Jill, ...

Then, the contest page would just include each subpage, doing something like:

===  [[User:Jill|Jill]] (159 p) ===
5 articles, {{formatnum:33.83}} kB
{{:Contest root/contributions/Jill}}

===  [[User:Jack|Jack]] (139 p) ===
4 articles, {{formatnum:23.83}} kB
{{:Contest root/contributions/Jack}}

This way, we don't lose functionality, and we would hit the problem only if the contributions of one single user hit the 2MB mark.

I like this idea the best, and it is also what @zache-fi has suggested.

@zache-fi
Copy link

zache-fi commented Feb 5, 2025

It still could/would hit to the expanded page size limit.

@jhsoby
Copy link
Member Author

jhsoby commented Feb 5, 2025

It still could/would hit to the expanded page size limit.

If that turns out to be a problem, couldn't we just link to the subpages instead of transcluding them?

@zache-fi
Copy link

zache-fi commented Feb 5, 2025

Yes, my original idea was just to link to the page.

@jcreusand
Copy link

You're right, I see now that the post-expand include size is again 2 MB, so we wouldn't gain anything by transcluding the pages.

Should we create the subpages every time, or only if we get close to the 2MB mark?

@jhsoby
Copy link
Member Author

jhsoby commented Feb 6, 2025

I think only when we get close to the 2MB mark. In the majority of cases, we don't need to split it, it is only when a contest gets really popular that we need to consider that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants