def invoke_function()

in apply/src/awsqs_kubernetes_resource/vpc.py [0:0]


def invoke_function(func_arn, event, sess):
    lmbd = sess.client("lambda")
    while True:
        try:
            response = lmbd.invoke(
                FunctionName=func_arn,
                InvocationType="RequestResponse",
                Payload=json.dumps(event).encode("utf-8"),
            )
            return json.loads(response["Payload"].read().decode("utf-8"))
        except lmbd.exceptions.ResourceConflictException as e:
            if "The operation cannot be performed at this time." not in str(e):
                raise
            LOG.error(str(e))
            time.sleep(10)