question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with init logic

See original GitHub issue

Currently JDA requires all guilds and all of the associated entities to be loaded before starting to fire events. This has serious effects as entire shards can get stuck on a single guild refusing to connect to the gateway. In addition to that JDA can have serious cache issues during outages that can lead to memory issues due to duplicated cache entries that don’t get removed.

  • Guilds should not prevent startup
  • Events should fire when all required entities are loaded
  • Cache should be aware of duplicates
  • Properly handle unavailability

We have ideas of adding a GuildReadyEvent in addition to ReadyEvent which would be useful to allow events to fire even if not all guilds are ready yet. The ReadyEvent would be fired when all guilds have been initialized, however events may already have fired for them.

I will redirect the issue traffic of #625 / #602 / #512 to this issue because they are closely related to one-another but I will keep them open for now.

As I don’t have a lot of free time at the moment, I cannot give any ETA on when I will find time to work on these proposals. This most likely requires a rewrite of JDA internals.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
MinnDevelopmentcommented, Jul 5, 2018

I’ve started planning how the new init system should be setup.

The first issue I want to tackle is that we have the logic for setting up the session split across the library in several different classes. I believe it would be sensible to focus all of the setup logic for guilds into a single controller (GuildSetupManager or similar). This manager would then be the central facility to handle the setup for each guild.

Currently I believe this is the list of things that would need to rely on the new manager system:

  • GuildLock
  • EntityBuilder
  • ReadyHandler
  • GuildMemberChunkHandler
  • GuildCreateHandler
  • GuildDeleteHandler

All of these classes should instead of keeping their own cache use the new manager system and just pass information to it. The manager system would then advance the setup for the guild and decide if it is ready for usage.

For example:

  1. ReadyHandler receives guilds
  2. The guilds are passed to GuildSetupManager
  3. GuildCreateHandler receives guild data
  4. The guild is updated in the GuildSetupManager
  5. GuildSetupManager decides if it should start chunking …

The logic here is not really planned, I just want to set an example on how it would work differently to the current system.

This way we have a codebase that can easily be found and understood by a contributor, rather than a complex and laid out system which spans across the api. Additionally we can change how the logic works and possibly allow events to be fired before all guilds are ready.

6reactions
DV8FromTheWorldcommented, Sep 7, 2018

I am so hype for the guild setup rewrite to go live.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If Logic Pro isn't working - Apple Support
Learn what to do if Logic Pro won't open, you can't play or record in a project, or you're having another issue.
Read more >
Problem of initialization in C++ - GeeksforGeeks
In this article, we will discuss the problem of initialization in C++, the data members of a class have private scope by default, ......
Read more >
Please elaborate the section "Custom initialization logic" #1191
Hi, I came here specifically to learn about user and roles initialization indeed, but it's still unclear to me where would be the...
Read more >
A device was found, but it was removed before initialization ...
This error appears when the Logic app detects that a device gets physically disconnected from the PC during initialization. This could be due...
Read more >
Retry logic in Init state? - Help - UiPath Community Forum
The problem occurs if there is a failure in the INIT state, then the bot will completely shut down without retrying. Is there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found