arena icon indicating copy to clipboard operation
arena copied to clipboard

Refactors code to support inheritance

Open anuragagarwal561994 opened this issue 6 years ago • 2 comments

At present everywhere there are checks for whether the queue is bull or not based on which the functionalities differ.

In this PR, this task have been properly handled by using classes and inheritance where by which all the bee related logic goes in bee.js and all the bull related logic in respective bull.js.

If another queue has to be integrated in future, it will be so much easier to just write another implementation which implementation details which affecting the core functionalities of the UI.

This makes the code more concise, easy to understand and extendable without extra if else conditions.

Three classes are mainly used:

  1. Queue: which holds the actual queue within it and provides a common interface for the application to react on function calls.
  2. Job: acts as an adapter for jobs for different queue implementation.
  3. JobData: represents not the actual job object but just the data that can be exposed to UI, JSON or anywhere else.

anuragagarwal561994 avatar Nov 30 '19 10:11 anuragagarwal561994

@skeggse Just wanted to confirm why have return void res.**json type changes have been added?

anuragagarwal561994 avatar Dec 05 '19 04:12 anuragagarwal561994

@skeggse A thorough testing is still required, I did testing with just bull queue of some of the basic functionalities that I was using. I thought to first get a review done before we can move onto complete testing again together.

There should not be any potential risks associated as such, in this code refactor I carefully converted all the if and else statements to different classes. Not sure if I understood your statement here correctly.

anuragagarwal561994 avatar Dec 05 '19 05:12 anuragagarwal561994