While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
from localstack.services import generic_proxy  
        
        LAMBDA_EXECUTOR.startup()
        
        validate_lambda_config()
        
        import localstack.contrib.thundra  
        generic_proxy.serve_flask_app(app=app, port=port)
    except Exception:
        LOG.exception("Error while starting up lambda service")
        raise
def on_config_change(config_key: str, config_newvalue: str) -> None:
    global LAMBDA_EXECUTOR
    if config_key != "LAMBDA_EXECUTOR":
        return
    LOG.debug(
        "Received config event for lambda executor - Key: '{}', Value: {}".format(
            config_key, config_newvalue
        )
    )
    LAMBDA_EXECUTOR.cleanup()
    LAMBDA_EXECUTOR = lambda_executors.AVAILABLE_EXECUTORS.get(
        get_executor_mode(), lambda_executors.DEFAULT_EXECUTOR
    )
    LAMBDA_EXECUTOR.startup()
def register_config_listener():
    from localstack.utils import config_listener
    config_listener.CONFIG_LISTENERS.append(on_config_change)
register_config_listener()