Don't duplicate samplers when adding (#2354)

fixes #2351 and #1791
This commit is contained in:
Will Cole 2024-11-22 05:00:42 -05:00 committed by GitHub
parent 1f140749d4
commit ad983c99d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -63,9 +63,10 @@ def set_samplers():
def add_sampler(sampler):
global all_samplers, all_samplers_map
all_samplers.append(sampler)
all_samplers_map = {x.name: x for x in all_samplers}
set_samplers()
if sampler.name not in [x.name for x in all_samplers]:
all_samplers.append(sampler)
all_samplers_map = {x.name: x for x in all_samplers}
set_samplers()
return