django-restit 4.2.43__py3-none-any.whl → 4.2.44__py3-none-any.whl
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.
- account/rpc/group.py +1 -1
- {django_restit-4.2.43.dist-info → django_restit-4.2.44.dist-info}/METADATA +1 -1
- {django_restit-4.2.43.dist-info → django_restit-4.2.44.dist-info}/RECORD +9 -9
- location/providers/iplookup/restit.py +1 -1
- rest/__init__.py +1 -1
- taskqueue/models.py +21 -1
- taskqueue/worker.py +6 -5
- {django_restit-4.2.43.dist-info → django_restit-4.2.44.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.43.dist-info → django_restit-4.2.44.dist-info}/WHEEL +0 -0
account/rpc/group.py
CHANGED
@@ -83,7 +83,7 @@ def rest_on_membership(request, pk=None):
|
|
83
83
|
@rd.login_required
|
84
84
|
def rest_on_users_membership(request, group_id=None):
|
85
85
|
ms = request.member.getMembershipFor(group_id, include_parents=True)
|
86
|
-
if ms is None:
|
86
|
+
if ms is None or not ms.is_enabled:
|
87
87
|
return rv.restStatus(request, False, error="not found", error_code=404)
|
88
88
|
return ms.restGet(request)
|
89
89
|
|
@@ -38,7 +38,7 @@ account/periodic.py,sha256=-u0n-7QTJgDOkasGhBAPwHAwjpqWGA-MZLEFkVTqCGU,874
|
|
38
38
|
account/rpc/__init__.py,sha256=SGF0M_-H0dKh3b1apSX29BotNWAvITYccGQVC0MIjL8,336
|
39
39
|
account/rpc/auth.py,sha256=eywdJSjsi_Ds2pM4wnltPJUfjIQqf6r6e99eKS7q3BA,15593
|
40
40
|
account/rpc/device.py,sha256=fbbZFp3cUdhVXvD7gVFOqFWj4hKS3bjZKD_aF5fQxd8,2852
|
41
|
-
account/rpc/group.py,sha256=
|
41
|
+
account/rpc/group.py,sha256=eW5p0TbJC7b77Xf7CTqLm-Qq_r1FPbGmSuVWrQR37uA,3823
|
42
42
|
account/rpc/member.py,sha256=PU-Uz5KUI_BZFy-F-taDqAfnt_AwONYXSzUvfm7eyTw,1264
|
43
43
|
account/rpc/notify.py,sha256=Q2YWejP36egeF060Hih5uX4Psv_B8NWlLLPi7iDYlIw,3344
|
44
44
|
account/rpc/oauth.py,sha256=ISLVsR5HvKALANokaOFRvF4FTRxWtXPvVnZAYANKxpo,2864
|
@@ -134,7 +134,7 @@ location/providers/iplookup/extremeip.py,sha256=QNRGhwXXsOuJL2M-xiI2pFN_6LP2HkqS
|
|
134
134
|
location/providers/iplookup/geoplugin.py,sha256=RK_6McxHYlVVMVdJ2rCafw-kqMfzMm3g_tJjBwcKXYg,2121
|
135
135
|
location/providers/iplookup/ipapi.py,sha256=cyVs_n4GYvmLsPn8jDOcfevPzWkwBs22PSzoYRzVhDo,1797
|
136
136
|
location/providers/iplookup/ipinfo.py,sha256=G3mrBQOAOzWkQBXf8uF98-xVPSA4HGAkYl4PlwmeKVU,1265
|
137
|
-
location/providers/iplookup/restit.py,sha256=
|
137
|
+
location/providers/iplookup/restit.py,sha256=UJlQ_-X85YhyO4Yqt7ys8-MFY_zQcAKHecaIOxL844U,937
|
138
138
|
location/providers/location/__init__.py,sha256=ki4sfPrgHMMr50GCKGZb2NDK0Unl8xkgcWJT7fsWgwA,42
|
139
139
|
location/providers/location/google.py,sha256=RXZoYXUcTerE3-7z2BciEuDJJB-f-0_F6jWLnEK5v8w,2860
|
140
140
|
location/providers/timezones/__init__.py,sha256=enslc1cVTju3GKrvpLoAxSHUKkLeREhed-eHkvHWdoM,46
|
@@ -359,7 +359,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
359
359
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
360
360
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
361
361
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
362
|
-
rest/__init__.py,sha256=
|
362
|
+
rest/__init__.py,sha256=D1F9OsFxtJr7AuWmena-TkvTjJPlbM2SRa6S8jjJtkk,121
|
363
363
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
364
364
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
365
365
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -440,7 +440,7 @@ taskqueue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
440
440
|
taskqueue/admin.py,sha256=E6zXoToS_ea3MdoGjZzF1JiepWFtDSoZUQdan8H-pXI,208
|
441
441
|
taskqueue/migrations/0001_initial.py,sha256=JwYib8CK5ftSXlfxKZUcKEEVsXktNB5q3h-2tu9inGk,4738
|
442
442
|
taskqueue/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
443
|
-
taskqueue/models.py,sha256=
|
443
|
+
taskqueue/models.py,sha256=tCFAKSr8JybUJV4gijg3wUCwQMJiHUsRBgHH2CWonfY,22119
|
444
444
|
taskqueue/periodic.py,sha256=2i0271khrCow3hDmlNEcoAZnesBVl40jd7MIim2Cxs4,3543
|
445
445
|
taskqueue/rpc.py,sha256=If5E9D9AR2RqW4lHRaDuD9L9b9ZfL_PaBQ6iX91ehvU,5736
|
446
446
|
taskqueue/tq.py,sha256=PzSoDrawYcqZylruEgsK95gcJ4J_VhdM6rxg9V6_X8E,942
|
@@ -450,7 +450,7 @@ taskqueue/transports/http.py,sha256=kRBjHiwTmk5b4TMdZWt1EKKcjfSlX8DFmtmJaRGZQFw,
|
|
450
450
|
taskqueue/transports/s3.py,sha256=fMosL893u1iQdo6Y1djwb7KEoNo6TTsDPJl13OJdJP8,1913
|
451
451
|
taskqueue/transports/sftp.py,sha256=jT1_krjTHA7DCAukD85aGYRCg9m0cEH9EWzOC-wJGdk,1891
|
452
452
|
taskqueue/transports/sms.py,sha256=H1-LIGEMfbUNqJD9amRcsvKUSwtz9yBj1QNfB7EHjHE,142
|
453
|
-
taskqueue/worker.py,sha256=
|
453
|
+
taskqueue/worker.py,sha256=u7H-FLkz7vpBoDaab9hpw4RduvG1ZTdtlw3PSHRBmUw,15737
|
454
454
|
telephony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
455
455
|
telephony/admin.py,sha256=iOdsBfFFbBisdqKSZ36bIrh_z5sU0Wx_PkaFi8wd1iA,243
|
456
456
|
telephony/decorators.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -492,7 +492,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
492
492
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
493
493
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
494
494
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
495
|
-
django_restit-4.2.
|
496
|
-
django_restit-4.2.
|
497
|
-
django_restit-4.2.
|
498
|
-
django_restit-4.2.
|
495
|
+
django_restit-4.2.44.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
496
|
+
django_restit-4.2.44.dist-info/METADATA,sha256=ZgC_TvH6w7_xLrj9Anw73cJI9jNaC_dJ8AfuybTH6mw,7594
|
497
|
+
django_restit-4.2.44.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
498
|
+
django_restit-4.2.44.dist-info/RECORD,,
|
@@ -26,7 +26,7 @@ def getLocation(ip):
|
|
26
26
|
if GEOIP_RESTIT_HOST is None:
|
27
27
|
return None
|
28
28
|
params = {"ip": ip}
|
29
|
-
url = f"https://{GEOIP_RESTIT_HOST}/
|
29
|
+
url = f"https://{GEOIP_RESTIT_HOST}/api/location/ip/lookup"
|
30
30
|
res = requests.get(url, params=params)
|
31
31
|
if res.status_code != 200:
|
32
32
|
return None
|
rest/__init__.py
CHANGED
taskqueue/models.py
CHANGED
@@ -31,6 +31,10 @@ TASK_STATES = [
|
|
31
31
|
(TASK_STATE_CANCELED, 'canceled')
|
32
32
|
]
|
33
33
|
|
34
|
+
TQ_RETRY_BACKOFF_FACTOR = settings.get("TQ_RETRY_BACKOFF_FACTOR", 2)
|
35
|
+
TQ_RETRY_ATTEMPTS = settings.get("TQ_RETRY_ATTEMPTS", 5)
|
36
|
+
TQ_RETRY_DELAY = settings.get("TQ_RETRY_DELAY", 60)
|
37
|
+
|
34
38
|
def getAppHandler(app_name, fname):
|
35
39
|
try:
|
36
40
|
# module = __import__(app_name + '.tq', globals(), locals(), ['*'], 0)
|
@@ -143,6 +147,12 @@ class Task(models.Model, RestModel):
|
|
143
147
|
return self.runtime
|
144
148
|
return (datetime.now() - self.started_at).total_seconds()
|
145
149
|
|
150
|
+
@property
|
151
|
+
def max_attempts(self):
|
152
|
+
if self.data:
|
153
|
+
return self.data.get("retry_max_attempts", TQ_RETRY_ATTEMPTS)
|
154
|
+
return TQ_RETRY_ATTEMPTS
|
155
|
+
|
146
156
|
def set_action(self, value):
|
147
157
|
if value == "retry_now":
|
148
158
|
self.retry_now()
|
@@ -187,7 +197,17 @@ class Task(models.Model, RestModel):
|
|
187
197
|
def retry_later(self, reason=None, from_now_secs=None):
|
188
198
|
if reason:
|
189
199
|
self.reason = reason
|
190
|
-
if from_now_secs:
|
200
|
+
if from_now_secs == -1:
|
201
|
+
# allow backoff retry
|
202
|
+
if self.data:
|
203
|
+
bof = self.data.get("retry_bof", TQ_RETRY_BACKOFF_FACTOR)
|
204
|
+
delay = self.data.get("retry_delay", TQ_RETRY_DELAY)
|
205
|
+
else:
|
206
|
+
bof = TQ_RETRY_BACKOFF_FACTOR
|
207
|
+
delay = TQ_RETRY_DELAY
|
208
|
+
attempts = self.attempts - 1
|
209
|
+
from_now_secs = delay * (bof ** attempts)
|
210
|
+
if from_now_secs is not None:
|
191
211
|
# this will not run the task again until after this time has been hit
|
192
212
|
self.scheduled_for = datetime.now() + timedelta(seconds=from_now_secs)
|
193
213
|
self.state = TASK_STATE_RETRY
|
taskqueue/worker.py
CHANGED
@@ -178,7 +178,7 @@ class WorkManager(object):
|
|
178
178
|
pass
|
179
179
|
|
180
180
|
def processBacklog(self):
|
181
|
-
tasks = Task.objects.filter(state__in=[0,1,2])
|
181
|
+
tasks = Task.objects.filter(state__in=[0, 1, 2])
|
182
182
|
for task in tasks:
|
183
183
|
if task.channel in self.subscribe_to:
|
184
184
|
if task.cancel_requested:
|
@@ -196,8 +196,9 @@ class WorkManager(object):
|
|
196
196
|
def _on_webrequest(self, task):
|
197
197
|
if http.REQUEST(task):
|
198
198
|
task.completed()
|
199
|
-
elif task.attempts <
|
200
|
-
|
199
|
+
elif task.attempts < task.max_attempts:
|
200
|
+
# -1 will auto calculate retry with back off
|
201
|
+
task.retry_later(from_now_secs=-1)
|
201
202
|
else:
|
202
203
|
task.failed("max attempts")
|
203
204
|
|
@@ -212,8 +213,8 @@ class WorkManager(object):
|
|
212
213
|
resp = s3.UPLOAD(task)
|
213
214
|
if resp:
|
214
215
|
task.completed()
|
215
|
-
elif task.
|
216
|
-
task.retry_later(from_now_secs
|
216
|
+
elif task.attempts < task.max_attempts:
|
217
|
+
task.retry_later(from_now_secs=-1)
|
217
218
|
else:
|
218
219
|
task.failed()
|
219
220
|
|
File without changes
|
File without changes
|