bugfix: reduce has not sequence 500 error

When i start app, Visit http://localhost:/debug see it:

```
TypeError: reduce() of empty sequence with no initial value
```

So if diamond.keys() has not length. direct set `plugins_num = 0`