PacketCloud / ALVIS.js

ALVIS (Asynchronous Learning Virtual Intelligence System) is a server management and utility bot built for the voice and text chat service, Discord. It utilizes Google's DialogFlow servers to introduce natural language request processing to the bot; allowing for communication in plain English - not just commands.
MIT License
0 stars 2 forks source link

Newly added audio files not added to library correctly. #22

Open aschuldhaus opened 7 years ago

aschuldhaus commented 7 years ago

New sounds/songs are not correctly added to the library. They are not returned when searched, and/or are appended to the end of the sound/song list, rather than inserted alphabetically. Cause still unknown. Attempts to resolve this issue seem to have failed.

Best bet is this is an issue caused by the asynchronous behaviour of certain methods; order of execution.

aschuldhaus commented 7 years ago

Fixed in next commit (v0.7.7).

aschuldhaus commented 6 years ago

Issue re-appeared after rewriting some methods.

Looking into issue now.

aschuldhaus commented 6 years ago

Issue appears to be related to the unintentional duplication of instances of the same objects (soundData, musicData) being out of sync when updating. One copy might be up-to-date while the other is not, resulting in sounds existing or missing from library when they should not. This duplication is a result of the objects being part of the Util class, and the fact that two (or more) instances of this class are used; one during boot, and the other during operation.

As a fix, I am moving the soundData and musicData objects to be part of the bot.basic object, then re-referenced by the Util class, so multiple instances will reference the same sound/music data objects. I also need to find all locations these structures are updated; and make sure they are updating the basic.soundData or basic.musicData objects from now on (not changing what Util.soundData or Util.musicData are referencing, as this would reintroduce the bug during operation).