scrapyr icon indicating copy to clipboard operation
scrapyr copied to clipboard

Redis global connection variable

Open donutloop opened this issue 6 years ago • 3 comments

In my point of view, this app shouldn't rely on a global Redis connection instance instead of it should inject this connection into each component to have a clear dependence bounding. This simplifies the reasoning of types and you could replace his type by an interface.

Example:

newJobByID(id, redisConn)

Bad Example:

This dep of redisConn is hidden

newJobByID(id)

If this proposal is good and you want you accepted it then I could find some spare time to refactor it. How do you test your changes by a test project?

donutloop avatar Oct 30 '19 07:10 donutloop

Welcome @donutloop ,

Your point of view isn't wrong,

Actually I started this project to only use Redis as its main store,

But if you want to refactor it and make it use an interface i.e IBackend and make it pluggable so the user can choose which engine to be used, I think it will be perfect.

alash3al avatar Oct 30 '19 21:10 alash3al

Hi @alash3al, how do you test your project to verify that all workflows are still working as expected?

donutloop avatar Oct 31 '19 18:10 donutloop

@donutloop really sorry for that late reply, currently I don't have any testing plan so just pick yours I don't have any problem

alash3al avatar Nov 07 '19 07:11 alash3al