Skip to content

Commit

Permalink
fix: detect database number for Heroku Redis
Browse files Browse the repository at this point in the history
Close #55, #52
  • Loading branch information
luin committed Feb 18, 2017
1 parent 9ecce73 commit f2c6d7e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ $ npm install
$ npm run deploy
```

## Connect to Heroku
Medis can connect to Heroku Redis addon to manage your data. You just need to call `heroku redis:credentials --app APP` to get your redis credential:

```shell
$ heroku redis:credentials --app YOUR_APP
redis://x:PASSWORD@HOST:PORT
```

And then input `HOST`, `PORT` and `PASSWORD` to the connection tab.

## I Love This. How do I Help?

* Simply star this repository :-)
Expand Down
23 changes: 10 additions & 13 deletions client/components/main/Main/Database/KeyBrowser/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@ class Footer extends React.Component {

updateDBCount() {
this.props.redis.config('get', 'databases', (err, res) => {
if (!err) {
if (res[1]) {
this.setState({ databases: Number(res[1]) });
} else {
const redis = this.props.redis.duplicate();
const select = redis.select.bind(redis);
this.guessDatabaseNumber(select, 15).then((count) => {
console.log('===', count)
return typeof count === 'number' ? count : this.guessDatabaseNumber(select, 1, 0);
}).then((count) => {
this.setState({ databases: count + 1 });
});
}
if (!err && res[1]) {
this.setState({ databases: Number(res[1]) });
} else {
const redis = this.props.redis.duplicate();
const select = redis.select.bind(redis);
this.guessDatabaseNumber(select, 15).then((count) => {
return typeof count === 'number' ? count : this.guessDatabaseNumber(select, 1, 0);
}).then((count) => {
this.setState({ databases: count + 1 });
});
}
});
}
Expand Down

0 comments on commit f2c6d7e

Please sign in to comment.