Skip to content

Commit

Permalink
meta cache bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
exiahuang committed Sep 19, 2019
1 parent ab7ea1e commit 9879fd3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/sfdc.version.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SalesforceXyTools",
"version": "2.1.8",
"version": "2.1.9",
"description": "SalesforceXyTools for Sublime Text is Rapid development tools for Salesforce Development.",
"author": "Exia.Huangxy",
"email": "exia.huang@outlook.com",
Expand Down
3 changes: 3 additions & 0 deletions help/bug-fix-history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# SalesforceXyTools Update History

## 2.1.9
* meta cache bug fix

## 2.1.8
* document fix

Expand Down
2 changes: 1 addition & 1 deletion messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"2.1.8": "help/bug-fix-history.md",
"2.1.9": "help/bug-fix-history.md",
"install": "help/install.txt"
}
4 changes: 2 additions & 2 deletions packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"description": "SalesforceXyTools for Sublime Text is Rapid development tools for Salesforce Development.",
"author": "Exia.Huangxy",
"homepage": "https://github.com/exiahuang/SalesforceXyTools",
"last_modified": "2019-07-07 15:00:00",
"last_modified": "2019-09-19 22:00:00",
"platforms": {
"*": [
{
"version": "2.1.8",
"version": "2.1.9",
"release_notes": "",
"url": "https://nodeload.github.com/exiahuang/SalesforceXyTools/zipball/master"
}
Expand Down
16 changes: 10 additions & 6 deletions salesforce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,16 @@ def _listMetadataLimit(self, query_option_list):
if query_option_list is None or len(query_option_list) == 0:
return []
# self.sf_version
request_body = soap_envelopes.get_list_metadata_envelope(session_id=self.session_id, query_option_list=query_option_list,api_version=self.sf_version)
result = self._doSoapQueryList("listMetadataResponse", request_body)
print(result)
if not isinstance(result, list):
result = []
return result
try:
request_body = soap_envelopes.get_list_metadata_envelope(session_id=self.session_id, query_option_list=query_option_list,api_version=self.sf_version)
result = self._doSoapQueryList("listMetadataResponse", request_body)
print(result)
if not isinstance(result, list):
result = []
return result
except Exception as e:
print(e)
return []

def describeMetadata(self):
if self.describe_metadata_response:
Expand Down
15 changes: 14 additions & 1 deletion util.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,18 @@ def is_exist(self):
def get_cache(self):
if self.all_cache:
return self.all_cache
self.all_cache = self._load()
sub_thread = threading.Thread(target=self._load)
sub_thread.start()
if sub_thread.is_alive():
sleep(1)
self.all_cache = {}
if self.is_exist():
data = {}
encoding = 'utf-8'
with open(self.full_path, "r", encoding=encoding) as fp:
data = json.loads(fp.read(),encoding)
self.all_cache = data
# self.all_cache = self._load()
return self.all_cache

def reload(self):
Expand Down Expand Up @@ -273,6 +284,7 @@ def reload(self):
allMetadataMap["sobjects"][name] = meta
allMetadataMap["lastUpdated"] = str(datetime.now())
self.save_dict(allMetadataMap)
self.sublconsole.showlog("load metadata cache done.")
# self.sublconsole.save_and_open_in_panel(json.dumps(allMetadataMap, ensure_ascii=False, indent=4), self.save_dir, self.file_name , is_open=False)

# get all fields from sobject
Expand Down Expand Up @@ -352,6 +364,7 @@ def reload(self):
allMetadataResult = meta_api.getAllMetadataMap()
allMetadataResult["AuraDefinition"] = self._load_lux_cache()
self.save_dict(allMetadataResult)
self.sublconsole.showlog("load metadata cache done.")

def _covert_AuraDefinition_to_cache_dict(self, AuraDefinition_records):
AuraDefinition_MetadataMap = {}
Expand Down

0 comments on commit 9879fd3

Please sign in to comment.