Skip to content

Instantly share code, notes, and snippets.

@AndyHoang
Created October 21, 2019 02:54
Show Gist options
  • Save AndyHoang/2f7f958bbeeaba4e4ea2abe793fc32e4 to your computer and use it in GitHub Desktop.
Save AndyHoang/2f7f958bbeeaba4e4ea2abe793fc32e4 to your computer and use it in GitHub Desktop.
>>> CarrierMasterData.objects.filter(id=81) // my caching models
('GET', '{pp_data_io}q:8f753017faabca24a400ce1477b2d689')
('EVALSHA', 'f6b93ec749d56aefa37c49bbc5e7a6eedd0d4ec3', 3, '{pp_data_io}', '{pp_data_io}q:8f753017faabca24a400ce1477b2d689', '', b'\x80\x04\x95\xf9\x07\x00\x00\x00\x00\x00\x00]\x94\x8c\x15django.db.models.base\x94\x8c\x0emodel_unpickle\x94\x93\x94\x8c\x03api\x94\x8c\x11CarrierMasterData\x94\x86\x94\x85\x94R\x94}\x94(\x8c\x06_state\x94h\x01\x8c\nModelState\x94\x93\x94)\x81\x94}\x94(\x8c\x06adding\x94\x89\x8c\x02db\x94\x8c\x07default\x94ub\x8c\x02id\x94KQ\x8c\x04name\x94\x8c\rDHL eCommerce\x94\x8c\tslug_name\x94\x8c\x0fdhl-global-mail\x94\x8c\ncarrier_id\x94\x8c\x06dhleco\x94\x8c\x0caftership_id\x94]\x94(\x8c\x0fdhl-global-mail\x94\x8c\x14dhl-global-mail-asia\x94e\x8c\rcarrier_17_id\x94]\x94(\x8c\x0507048\x94\x8c\x0507047\x94e\x8c\x15carrier_countries_iso\x94]\x94\x8c\x11carrier_countries\x94]\x94\x8c\x10carrier_language\x94\x8c\x02en\x94\x8c\x10carrier_cs_phone\x94\x8c\x0f+1 317 554 5191\x94\x8c\x0bcarrier_url\x94\x8c"http://webtrack.dhlglobalmail.com/\x94\x8c\x14carrier_url_tracking\x94\x8c"http://webtrack.dhlglobalmail.com/\x94\x8c\x19carrier_support_languages\x94]\x94\x8c\x02en\x94a\x8c\x0ccarrier_logo\x94\x8c\ndhleco.png\x94\x8c\x08comments\x94\x8c\x08Complete\x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\x94\x8c2https://www.parcelmonitor.com/track-dhl-ecommerce/\x94\x8c allowed_concurrent_request_count\x94Kd\x8c\rpostal_scrape\x94\x88\x8c\x0cupdated_date\x94\x8c\x08datetime\x94\x8c\x08datetime\x94\x93\x94C\n\x07\xe3\x06\x18\n\x06\x19\x0c\xa7\xe9\x94\x8c\x04pytz\x94\x8c\x04_UTC\x94\x93\x94)R\x94\x86\x94R\x94\x8c\tis_hidden\x94\x89\x8c\x13merchant_parameters\x94]\x94\x8c\x06rating\x94}\x94(\x8c\x10rating_main__avg\x94G@\x03\xc9\xf1\xb4\x10|\xf0\x8c\x12rating_main__count\x94M\x7f9\x8c\x13rating_overall__avg\x94G@\x03\'\xd2\x01\x1bx>\x8c\x15rating_overall__count\x94M{\x17\x8c\x1crating_delivery_updates__avg\x94G@\x01.\xe9\x8a\xdc\xa9\xb3\x8c\x1crating_on_time_delivery__avg\x94G?\xff\xc5YR\xbdkG\x8c\x1erating_delivery_updates__count\x94M\x89\x18\x8c\x1erating_on_time_delivery__count\x94M\xbc\x1a\x8c\x1frating_delivery_experience__avg\x94G@\x00xi|$\xd1\xf6\x8c!rating_delivery_experience__count\x94M\x1e\x18u\x8c\x10last_calc_rating\x94h`C\n\x07\xe3\n\x14\x16\x1e\x13\t\xbf-\x94he\x86\x94R\x94\x8c\x0f_django_version\x94\x8c\x052.2.1\x94uba.', '{"carrier": [{"id": 81}]}', 900)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 250, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 274, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.6/site-packages/cacheops/query.py", line 321, in _fetch_all
self._cache_results(cache_key, self._result_cache)
File "/usr/local/lib/python3.6/site-packages/cacheops/query.py", line 207, in _cache_results
self._cond_dnfs, self._cacheprofile['timeout'], dbs=[self.db])
File "/usr/local/lib/python3.6/site-packages/funcy/decorators.py", line 39, in wrapper
return deco(call, *dargs, **dkwargs)
File "/usr/local/lib/python3.6/site-packages/cacheops/redis.py", line 19, in handle_connection_failure
return call()
File "/usr/local/lib/python3.6/site-packages/funcy/decorators.py", line 60, in __call__
return self._func(*self._args, **self._kwargs)
File "/usr/local/lib/python3.6/site-packages/cacheops/query.py", line 51, in cache_thing
timeout
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 2944, in __call__
return client.evalsha(self.sha, len(keys), *args)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 2079, in evalsha
return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
File "/usr/local/lib/python3.6/site-packages/rediscluster/utils.py", line 101, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rediscluster/client.py", line 344, in execute_command
slot = self._determine_slot(*args)
File "/srv/pp_data_io/api/utils/redis.py", line 49, in _determine_slot
return super(StrictRedisCluster1, self)._determine_slot(*args)
File "/usr/local/lib/python3.6/site-packages/rediscluster/client.py", line 285, in _determine_slot
raise RedisClusterException("{0} - all keys must map to the same key slot".format(command))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment