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

Querying A LOT of issues results in exceeding maximum embed size #44

Open
Jackenmen opened this issue Aug 5, 2021 · 0 comments
Open

Comments

@Jackenmen
Copy link
Collaborator

When you query a lot of issues, the cog might exceed the maximum embed size.

Example reproduction message (red is configured to Cog-Creators/Red-DiscordBot repository):

red#1 red#2 red#3 red#4 red#5 red#6 red#7 red#8 red#9 red#10 red#11 red#12 red#13 red#14 red#15 red#16 red#17 red#18 red#19 red#20 red#21 red#22 red#23 red#24 red#25 red#26 red#27 red#28 red#29 red#30 red#31 red#32 red#33 red#34 red#35 red#36 red#37 red#38 red#39 red#40 red#41 red#42 red#43 red#44 red#45 red#46 red#47 red#48 red#49 red#50 red#51 red#52 red#53 red#54 red#55 red#56 red#57 red#58 red#59 red#60 red#61 red#62 red#63 red#64 red#65 red#66 red#67 red#68 red#69 red#70 red#71 red#72 red#73 red#74 red#75 red#76 red#77 red#78 red#79 red#80 red#81 red#82 red#83 red#84 red#85 red#86 red#87 red#88 red#89 red#90 red#91 red#92 red#93 red#94 red#95 red#96 red#97 red#98 red#99 red#100 red#101 red#102 red#103 red#104 red#105 red#106 red#107 red#108 red#109 red#110 red#111 red#112 red#113 red#114 red#115 red#116 red#117 red#118 red#119 red#120 red#121 red#122 red#123 red#124 red#125 red#126 red#127 red#128 red#129 red#130 red#131 red#132 red#133 red#134 red#135 red#136 red#137 red#138 red#139 red#140 red#141 red#142 red#143 red#144 red#145 red#146 red#147 red#148 red#149 red#150 red#151 red#152 red#153 red#154 red#155 red#156 red#157 red#158 red#159 red#160 red#161 red#162 red#163 red#164 red#165 red#166 red#167 red#168 red#169 red#170 red#171 red#172 red#173 red#174 red#175 red#176 red#177 red#178 red#179 red#180 red#181 red#182 red#183 red#184 red#185 red#186 red#187 red#188 red#189 red#190 red#191 red#192 red#193 red#194 red#195 red#196 red#197 red#198 red#199 red#200 red#201 red#202 red#203 red#204 red#205 red#206 red#207 red#208 red#209 red#210 red#211 red#212 red#213 red#214 red#215 red#216 red#217 red#218 red#219 red#220 red#221 red#222 red#223 red#224 red#225 red#226 red#227 red#228 red#229 red#230 red#231 red#232 red#233 red#234 red#235 red#236 red#237 red#238 red#239 red#240 red#241 red#242 red#243 red#244 red#245 red#246 red#247 red#248 red#249 red#250 red#251 red#252 red#253 red#254 red#255 red#256 red#257 red#258 red#259 red#260 red#261 red#262 red#263

Traceback:

Ignoring exception in on_message_without_command
Traceback (most recent call last):
  File "C:\Users\Jakub\OneDrive\Dokumenty\Red-DiscordBot\.venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Jakub\OneDrive\Dokumenty\Sentinel\githubcards\core.py", line 270, in on_message_without_command
    await self._query_and_post(message, fetchable_repos)
  File "C:\Users\Jakub\OneDrive\Dokumenty\Sentinel\githubcards\core.py", line 309, in _query_and_post
    await message.channel.send(embed=embed)
  File "C:\Users\Jakub\OneDrive\Dokumenty\Red-DiscordBot\.venv\lib\site-packages\discord\abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "C:\Users\Jakub\OneDrive\Dokumenty\Red-DiscordBot\.venv\lib\site-packages\discord\http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed: Embed size exceeds maximum size of 6000

I also tried the same with 4k char limit:

red#1 red#2 red#3 red#4 red#5 red#6 red#7 red#8 red#9 red#10 red#11 red#12 red#13 red#14 red#15 red#16 red#17 red#18 red#19 red#20 red#21 red#22 red#23 red#24 red#25 red#26 red#27 red#28 red#29 red#30 red#31 red#32 red#33 red#34 red#35 red#36 red#37 red#38 red#39 red#40 red#41 red#42 red#43 red#44 red#45 red#46 red#47 red#48 red#49 red#50 red#51 red#52 red#53 red#54 red#55 red#56 red#57 red#58 red#59 red#60 red#61 red#62 red#63 red#64 red#65 red#66 red#67 red#68 red#69 red#70 red#71 red#72 red#73 red#74 red#75 red#76 red#77 red#78 red#79 red#80 red#81 red#82 red#83 red#84 red#85 red#86 red#87 red#88 red#89 red#90 red#91 red#92 red#93 red#94 red#95 red#96 red#97 red#98 red#99 red#100 red#101 red#102 red#103 red#104 red#105 red#106 red#107 red#108 red#109 red#110 red#111 red#112 red#113 red#114 red#115 red#116 red#117 red#118 red#119 red#120 red#121 red#122 red#123 red#124 red#125 red#126 red#127 red#128 red#129 red#130 red#131 red#132 red#133 red#134 red#135 red#136 red#137 red#138 red#139 red#140 red#141 red#142 red#143 red#144 red#145 red#146 red#147 red#148 red#149 red#150 red#151 red#152 red#153 red#154 red#155 red#156 red#157 red#158 red#159 red#160 red#161 red#162 red#163 red#164 red#165 red#166 red#167 red#168 red#169 red#170 red#171 red#172 red#173 red#174 red#175 red#176 red#177 red#178 red#179 red#180 red#181 red#182 red#183 red#184 red#185 red#186 red#187 red#188 red#189 red#190 red#191 red#192 red#193 red#194 red#195 red#196 red#197 red#198 red#199 red#200 red#201 red#202 red#203 red#204 red#205 red#206 red#207 red#208 red#209 red#210 red#211 red#212 red#213 red#214 red#215 red#216 red#217 red#218 red#219 red#220 red#221 red#222 red#223 red#224 red#225 red#226 red#227 red#228 red#229 red#230 red#231 red#232 red#233 red#234 red#235 red#236 red#237 red#238 red#239 red#240 red#241 red#242 red#243 red#244 red#245 red#246 red#247 red#248 red#249 red#250 red#251 red#252 red#253 red#254 red#255 red#256 red#257 red#258 red#259 red#260 red#261 red#262 red#263 red#264 red#265 red#266 red#267 red#268 red#269 red#270 red#271 red#272 red#273 red#274 red#275 red#276 red#277 red#278 red#279 red#280 red#281 red#282 red#283 red#284 red#285 red#286 red#287 red#288 red#289 red#290 red#291 red#292 red#293 red#294 red#295 red#296 red#297 red#298 red#299 red#300 red#301 red#302 red#303 red#304 red#305 red#306 red#307 red#308 red#309 red#310 red#311 red#312 red#313 red#314 red#315 red#316 red#317 red#318 red#319 red#320 red#321 red#322 red#323 red#324 red#325 red#326 red#327 red#328 red#329 red#330 red#331 red#332 red#333 red#334 red#335 red#336 red#337 red#338 red#339 red#340 red#341 red#342 red#343 red#344 red#345 red#346 red#347 red#348 red#349 red#350 red#351 red#352 red#353 red#354 red#355 red#356 red#357 red#358 red#359 red#360 red#361 red#362 red#363 red#364 red#365 red#366 red#367 red#368 red#369 red#370 red#371 red#372 red#373 red#374 red#375 red#376 red#377 red#378 red#379 red#380 red#381 red#382 red#383 red#384 red#385 red#386 red#387 red#388 red#389 red#390 red#391 red#392 red#393 red#394 red#395 red#396 red#397 red#398 red#399 red#400 red#401 red#402 red#403 red#404 red#405 red#406 red#407 red#408 red#409 red#410 red#411 red#412 red#413 red#414 red#415 red#416 red#417 red#418 red#419 red#420 red#421 red#422 red#423 red#424 red#425 red#426 red#427 red#428 red#429 red#430 red#431 red#432 red#433 red#434 red#435 red#436 red#437 red#438 red#439 red#440 red#441 red#442 red#443 red#444 red#445 red#446 red#447 red#448 red#449 red#450 red#451 red#452 red#453 red#454 red#455 red#456 red#457 red#458 red#459 red#460 red#461 red#462 red#463 red#464 red#465 red#466 red#467 red#468 red#469 red#470 red#471 red#472 red#473 red#474 red#475 red#476 red#477 red#478 red#479 red#480 red#481 red#482 red#483 red#484 red#485 red#486 red#487 red#488 red#489 red#490 red#491 red#492 red#493 red#494 red#495 red#496 red#497 red#498 red#499 red#500 red#501 red#502 red#503 red#504 red#505 red#506 red#507 red#508 red#509 red#510 red#511 red#512 red#513

Weirdly enough, the cost of requesting 500 issues is the same as the cost of requesting 1 issue so this can't be leveraged to use huge amounts of rate limit. I was also interested to see whether GitHub won't reject the API request for exceeding payload size or something like that but that didn't seem to happen either. Anyway, I still think we should probably just limit the number of issues we request to something like 50 and ignore all remaining message content. 50 is definitely more than I would expect the person to ever request on a normal basis but I think we should keep some wiggle room rather than put a limit that is too small.

With consideration of message components usage that we wanted to introduce, we could probably limit it to 26 (1 card + the max of 25 select options is what I've seen you test) which still gives wiggle room.

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

1 participant