aws-samples/sample-python-helper-aws-appconfig

update_config can cause BadRequestException

jrobbins-LiveData opened this issue · 2 comments

The early return in update_config (to deal with empty content when the config hasn't changed)

        if content == b"":
            return False

results in this error

BadRequestException('An error occurred (BadRequestException) when calling the GetLatestConfiguration operation: Request too early')

if the next call to update_config happens soon enough after this call.

The reason the exception is raised by get_latest_configuration is that this ealy return fails to update the variable (self._last_update_time) used to guard against calling before the negotiated minimum poll set via the RequiredMinimumPollIntervalInSeconds arg to start_configuration_session.

Changing the code to

            if content == b"":
                self._last_update_time = time.time()
                return False

would fix this problem.

Thanks for the report!

You're welcome! Thanks for the fix (along with an updated unit test!)