mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Fixed cache expiry for Unified Target configurations.
This commit is contained in:
parent
140509eea3
commit
7313407bec
1 changed files with 3 additions and 2 deletions
|
@ -604,7 +604,8 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
const manufacturerId = manufacturerIds[index];
|
const manufacturerId = manufacturerIds[index];
|
||||||
const targetId = `${target}+${manufacturerId}`;
|
const targetId = `${target}+${manufacturerId}`;
|
||||||
// Check to see if the cached configuration is the one we want.
|
// Check to see if the cached configuration is the one we want.
|
||||||
if (!storageObj || !storageObj.target || storageObj.target !== targetId) {
|
if (!storageObj || !storageObj.target || storageObj.target !== targetId
|
||||||
|
|| !storageObj.lastUpdate || checkTime - storageObj.lastUpdate > expirationPeriod) {
|
||||||
// Have to go and try and get the unified config, and then do stuff
|
// Have to go and try and get the unified config, and then do stuff
|
||||||
$.get(unifiedConfigBoard[manufacturerId], function(response) {
|
$.get(unifiedConfigBoard[manufacturerId], function(response) {
|
||||||
console.log('got unified config');
|
console.log('got unified config');
|
||||||
|
@ -612,7 +613,7 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
let tempObj = {};
|
let tempObj = {};
|
||||||
tempObj['data'] = response;
|
tempObj['data'] = response;
|
||||||
tempObj['target'] = targetId;
|
tempObj['target'] = targetId;
|
||||||
tempObj['checkTime'] = checkTime;
|
tempObj['lastUpdate'] = checkTime;
|
||||||
let newStorageObj = {};
|
let newStorageObj = {};
|
||||||
newStorageObj[storageTag] = tempObj;
|
newStorageObj[storageTag] = tempObj;
|
||||||
chrome.storage.local.set(newStorageObj);
|
chrome.storage.local.set(newStorageObj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue