OutpostUniverse / NetFixServer

0 stars 0 forks source link

Refactor do timed updates #55

Closed Brett208 closed 4 years ago

Brett208 commented 4 years ago

Further refactoring could be beneficial, but I think this is far enough to close #31.

Brett208 commented 4 years ago

Dan,

If you can suggest better function names, I can trash this branch and try to redo the changes with more discrete commits.

Function 1 (CheckTimedUpdates):

Function 2 (DoTimedUpdate):

Longer term, we probably want function 2 to check for each condition and pass into further discrete subfunctions functions to perform each task. Since the deeply nested loop and difficult logic had been reduced (well reduced in my mind), I had paused the work.

Sorry for the poor commits. The effort was fairly discovery in nature as I went along which makes the commit quality reduce. I had thought it was still passable enough to post instead of redoing all the changes.

DanRStevens commented 4 years ago

It seems the outer method is concerned with finding any out of date items in the full list, while the inner method is for updating a single item. They are effectively both "Do" methods, just with a different scope as to what is being acted upon.

Maybe something like UpdateSessionList and UpdateSession? Or SessionListTimedUpdate and SessionTimedUpdate?

Brett208 commented 4 years ago

I found a mistake I made when doing the refactor. Unfortunately, I made a different mistake in this refactor. I'll have to redo part of the work again to fix. The combination of flag bit operations with the deeply nested logic operations is eating my lunch. I am understanding the code better now though, for whatever that is worth...