Skip to content

Commit

Permalink
Merge branch 'main' into support/3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuch committed Sep 12, 2023
2 parents 150c770 + e04c01a commit 12d38dc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion code/zato-common/src/zato/common/ipc/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def invoke_by_pid(

# Log what we are about to do
log_msg = f'Invoking {service} on {cluster_name}:{server_name}:{target_pid}-tcp:{ipc_port}'
logger.info(log_msg)
logger.debug(log_msg)

# Use this URL path to be able to easily find requests in logs
url_path = f'{cluster_name}:{server_name}:{target_pid}-tcp:{ipc_port}-service:{service}'
Expand Down
2 changes: 1 addition & 1 deletion code/zato-common/src/zato/common/ipc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def invoke(
cluster_name, # type: str
server_name, # type: str
server_pid, # type: int
timeout=90, # type: int
timeout=90, # type: int
source_server_name, # type: str
source_server_pid, # type: int
) -> 'IPCResponse':
Expand Down
2 changes: 2 additions & 0 deletions code/zato-common/src/zato/common/typing_.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
Dict as dict_, \
Generator as generator_, \
Iterator as iterator_, \
IO as io_, \
NoReturn as noreturn, \
List as list_, \
Optional as optional, \
Expand Down Expand Up @@ -103,6 +104,7 @@
intsetdict = dict_[int, anyset]
intstrdict = dict_[int, str]
iterator_ = iterator_
iobytes_ = io_[bytes]
listnone = anylistnone
noreturn = noreturn
set_ = set_
Expand Down
2 changes: 1 addition & 1 deletion code/zato-common/src/zato/common/util/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ def wait_for_predicate(predicate_func, timeout, interval, log_msg_details=None,
# Use an explicit loop index for reporting
loop_idx = 1

logger.info('Entering wait-for-predicate -> %s -> %s', log_msg_details, is_fulfilled)
logger.debug('Entering wait-for-predicate -> %s -> %s', log_msg_details, is_fulfilled)

if not is_fulfilled:
start = datetime.utcnow()
Expand Down
11 changes: 8 additions & 3 deletions code/zato-common/src/zato/common/util/open_.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# ################################################################################################################################

if 0:
from zato.common.typing_ import binaryio_, textio_
from zato.common.typing_ import binaryio_, iobytes_, textio_

# ################################################################################################################################

Expand All @@ -28,12 +28,17 @@ def open_rb(path:'str') -> 'binaryio_':

# ################################################################################################################################

def open_rw(path:'str', encoding:'str'=default_encoding) -> 'textio_':
return open(path, 'w+', encoding=encoding)

# ################################################################################################################################

def open_w(path:'str', encoding:'str'=default_encoding) -> 'textio_':
return open(path, 'w', encoding=encoding)

# ################################################################################################################################

def open_rw(path:'str', encoding:'str'=default_encoding) -> 'textio_':
return open(path, 'w+', encoding=encoding)
def open_wb(path:'str') -> 'iobytes_':
return open(path, 'wb')

# ################################################################################################################################
13 changes: 7 additions & 6 deletions code/zato-server/src/zato/server/connection/cache.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# -*- coding: utf-8 -*-

"""
Copyright (C) 2019, Zato Source s.r.o. https://zato.io
Copyright (C) 2023, Zato Source s.r.o. https://zato.io
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""

from __future__ import absolute_import, division, print_function, unicode_literals

# stdlib
from base64 import b64encode
from logging import getLogger
Expand All @@ -27,6 +25,7 @@
from zato.cache import Cache as _CyCache
from zato.common.api import CACHE, ZATO_NOT_GIVEN
from zato.common.broker_message import CACHE as CACHE_BROKER_MSG
from zato.common.typing_ import cast_
from zato.common.util.api import parse_extra_into_dict

# Python 2/3 compatibility
Expand Down Expand Up @@ -809,7 +808,7 @@ def sync_after_clear(self):

class _NotConfiguredAPI:
def set(self, *args, **kwargs):
raise Exception('Default cache is not configured')
logger.warn('Default cache is not configured')
get = set

# ################################################################################################################################
Expand All @@ -820,7 +819,7 @@ class CacheAPI:
def __init__(self, server):
self.server = server
self.lock = RLock()
self.default = _NotConfiguredAPI()
self.default = cast_('Cache', _NotConfiguredAPI())
self.caches = {
CACHE.TYPE.BUILTIN:{},
CACHE.TYPE.MEMCACHED:{},
Expand Down Expand Up @@ -859,7 +858,9 @@ def after_state_changed(self, op, cache_name, data, _broker_msg=builtin_op_to_br
else:
data['is_value_pickled'] = True
value = _pickle_dumps(value)
data['value'] = b64encode(value)
value = b64encode(value)
value = value.decode('utf8')
data['value'] = value
else:
data['is_value_pickled'] = False

Expand Down

0 comments on commit 12d38dc

Please sign in to comment.