Refactoring: Backend class should work on ALApp instance, rather than app hash
vjekob opened this issue · comments
Partly, this is related to #41 and it certainly depends on it being done first.
Currently, Backend
class receives app hash as parameter for all back-end operations. Furthermore, it processes app ID and pool ID decisions directly. This class, just like the back end itself, should not even consider pools, it should simply access the hash property that should (as per #41) return pool ID when an app is in a pool.
At this particular point, there is an accidental infinite loop in telemetry during app initialization (not in production, don't worry!) simply because app ID is passed to telemetry from app initialization, but then Backend
class attempts to re-initialize the app because it doesn't know about the app, only about its hash. While this is a simple issue to fix, the root cause is deeper, and is twofold:
- Backend must not handle hashes directly, but
ALApp
instances; and ALApp
instances should return pool ID from ˙get hash(): string˙
function, if the app belongs to a pool
This would then provide for a much cleaner structure, easier to reuse and extend.