Skip to content

Commit

Permalink
set some sensible timeouts for servers that hang on requests to weird…
Browse files Browse the repository at this point in the history
… ports
  • Loading branch information
max-mapper committed May 29, 2011
1 parent a067b81 commit dd09112
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion assets/jquery.couch2.js
Expand Up @@ -37,7 +37,8 @@
designDocs: function(opts) {
return makeRequest($.extend(defaults, {
url: this.uri + "_all_docs",
data: {startkey:'"_design/"', endkey:'"_design0"', include_docs:true}
data: {startkey:'"_design/"', endkey:'"_design0"', include_docs:true},
timeout: 20000
}));
}

Expand Down
3 changes: 2 additions & 1 deletion background.html
Expand Up @@ -5,7 +5,8 @@
success: function(data){callback({data: data, ok: true})},
error: function(error){callback({data: error, ok: false})},
dataType: "json",
contentType: "application/json"
contentType: "application/json",
timeout: 5000
}
$.extend(reqOpts, options);
$.ajax(reqOpts);
Expand Down
7 changes: 4 additions & 3 deletions popup.html
Expand Up @@ -132,9 +132,10 @@
var currentPage;
chrome.tabs.getSelected(null, function(tab) {
currentPage = parseCouchApp(tab.url);
render('loading', 'container', {data: {host: currentPage.host}});
render('loading', 'container', {data: {message: "Detecting CouchDB on " + currentPage.host + "..."}});
checkForCouch(currentPage.host, function(exists) {
if(exists) {
render('loading', 'container', {data: {message: "Found CouchDB! Detecting couchapps on " + currentPage.host + "..."}});
var couchData = new CouchData(currentPage.host + ":5984");
couchData.loadDatabases().then(function (databases) {
var list = [];
Expand All @@ -156,7 +157,7 @@
});
} else {
render('form', 'container');
$('#notification').append("no exist");
$('#notification').append("CouchDB not found here :(");
}
})
});
Expand Down Expand Up @@ -185,7 +186,7 @@ <h1 class="title">Couch Replicator</h1>
<script id="loadingTemplate" type="text/mustache">
<div class="loading">
<img alt="Ajax-loader" id="spinner" src="assets/ajax-loader.gif" />
<span class="instructions">Detecting couchapps on {{host}}...</span>
<span class="instructions">{{message}}</span>
</div>
</script>

Expand Down

0 comments on commit dd09112

Please sign in to comment.