morp 5.2.0__tar.gz → 5.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: morp
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: Send and receive messages without thinking about it
5
5
  Home-page: http://github.com/Jaymon/morp
6
6
  Author: Jay Marcyes
@@ -19,5 +19,5 @@ from .exception import (
19
19
  )
20
20
 
21
21
 
22
- __version__ = '5.2.0'
22
+ __version__ = '5.2.2'
23
23
 
@@ -84,7 +84,6 @@ class Interface(InterfaceABC):
84
84
 
85
85
  this will set the raw db connection to self.connection
86
86
  """
87
-
88
87
  if self.connected: return self.connected
89
88
  if connection_config: self.connection_config = connection_config
90
89
 
@@ -138,11 +138,17 @@ class Dropfile(Interface):
138
138
  # one thing we can do with an exclusive lock to tell other processes
139
139
  # we have already looked at the file, I wish we could delete under an
140
140
  # exclusive lock)
141
- if kwargs.get("truncate", True):
142
- fp.truncate()
141
+ try:
142
+ if kwargs.get("truncate", True):
143
+ fp.truncate()
143
144
 
144
- fcntl.flock(fp, fcntl.LOCK_UN)
145
- fp.close()
145
+ fcntl.flock(fp, fcntl.LOCK_UN)
146
+ fp.close()
147
+
148
+ except ValueError:
149
+ # .truncate - ValueError: truncate of closed file
150
+ # .flock - ValueError: I/O operation on closed file
151
+ pass
146
152
 
147
153
  if kwargs.get("delete", True):
148
154
  message.delete()
@@ -9,6 +9,7 @@ import boto3
9
9
  from botocore.exceptions import ClientError
10
10
  from botocore.credentials import RefreshableCredentials
11
11
  from botocore.session import get_session
12
+ from datatypes import Datetime
12
13
 
13
14
  from ..compat import *
14
15
  from .base import Interface
@@ -82,6 +83,8 @@ class RefreshableSession(boto3.Session):
82
83
  profile_name=self.connection_config.options.get("profile_name", None),
83
84
  )
84
85
 
86
+ session_ttl = self.connection_config.options.get("session_ttl", 3600)
87
+
85
88
  # if an sts arn is given, get credential by assuming given role
86
89
  if arn := self.connection_config.options.get("arn", ""):
87
90
  sts_client = session.client(
@@ -95,10 +98,7 @@ class RefreshableSession(boto3.Session):
95
98
  "session_name",
96
99
  "morp"
97
100
  ),
98
- DurationSeconds=self.connection_config.options.get(
99
- "session_ttl",
100
- 3600
101
- ),
101
+ DurationSeconds=session_ttl,
102
102
  ).get("Credentials")
103
103
 
104
104
  credentials = {
@@ -114,7 +114,7 @@ class RefreshableSession(boto3.Session):
114
114
  "access_key": session_credentials.get("access_key"),
115
115
  "secret_key": session_credentials.get("secret_key"),
116
116
  "token": session_credentials.get("token"),
117
- "expiry_time": Datetime(seconds=self.session_ttl).isoformat(),
117
+ "expiry_time": Datetime(seconds=session_ttl).isoformat(),
118
118
  }
119
119
 
120
120
  return credentials
@@ -294,13 +294,13 @@ class Message(object):
294
294
 
295
295
  def ack(self):
296
296
  """Acknowledge this message has been processed"""
297
- cls.interface.ack(cls.get_name(), self.to_interface())
297
+ self.interface.ack(self.get_name(), self.to_interface())
298
298
 
299
299
  def release(self, **kwargs):
300
300
  """Release this message back to the interface so another message instance
301
301
  can pick it up
302
302
  """
303
- cls.interface.release(cls.get_name(), self.to_interface(), **kwargs)
303
+ self.interface.release(self.get_name(), self.to_interface(), **kwargs)
304
304
 
305
305
  def release_later(self, delay_seconds):
306
306
  """If you want to release the message and not have it be visible for some
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: morp
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: Send and receive messages without thinking about it
5
5
  Home-page: http://github.com/Jaymon/morp
6
6
  Author: Jay Marcyes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes