Open ChandlerSwift opened 3 years ago
In particular, this could be helpful for adding specifying what git branch to score against, likely as part of #103.
The reason that the redis queue entries weren't extensible was to make sure that duplicate requests would be deduped when added to the queue. JSON serialization doesn't guarantee that equal objects result in equal string values. Just something to think about.
@derpferd, from my testing, it seems that if no extra data is passed (and with json.dumps({}, sort_keys=True)
to prevent random ordering of keys) we do get equal string values. Of course, different versions of Python could treat whitespace differently, but in that case we just end up doing one unnecessary score run. That said, is there something I'm missing here?
Yes, I think that would work. I am sure you can also explicitly say how to handle whitespace as well.
Another thing to keep in mind is the potential_extra_data
containing some data that could reduce the number of possible dedups to zero. An example would be adding a timestamp.
With these two things in mind it shouldn't be a problem.
Currently our redis queue entries are of the form
{team_id}-{attack_id}
. This has worked, but it's pretty inflexible, and that's going to cause some problems for #103 in particular. Rather than the custom encoding/decoding logic we have, we should replace this with something extensible. JSON would be an easy possibility: