fix #576
This commit is contained in:
		
							parent
							
								
									1ea449aa3a
								
							
						
					
					
						commit
						8bcf03c652
					
				
							
								
								
									
										2
									
								
								admin.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								admin.go
									
									
									
									
									
								
							| @ -232,7 +232,7 @@ func runTask(rw http.ResponseWriter, req *http.Request) { | |||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			fmt.Fprintf(rw, "%v", err) | 			fmt.Fprintf(rw, "%v", err) | ||||||
| 		} | 		} | ||||||
| 		fmt.Fprintf(rw, "%s run success,Now the Status is %s", t.GetStatus()) | 		fmt.Fprintf(rw, "%s run success,Now the Status is %s", taskname, t.GetStatus()) | ||||||
| 	} else { | 	} else { | ||||||
| 		fmt.Fprintf(rw, "there's no task which named:%s", taskname) | 		fmt.Fprintf(rw, "there's no task which named:%s", taskname) | ||||||
| 	} | 	} | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								cache/memcache/memcache.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								cache/memcache/memcache.go
									
									
									
									
										vendored
									
									
								
							| @ -105,7 +105,6 @@ func (rc *MemcacheCache) IsExist(key string) bool { | |||||||
| 	} else { | 	} else { | ||||||
| 		return true | 		return true | ||||||
| 	} | 	} | ||||||
| 	return true |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // clear all cached in memcache. | // clear all cached in memcache. | ||||||
|  | |||||||
| @ -53,7 +53,6 @@ func (c *JsonConfigContainer) Bool(key string) (bool, error) { | |||||||
| 	} else { | 	} else { | ||||||
| 		return false, errors.New("not exist key:" + key) | 		return false, errors.New("not exist key:" + key) | ||||||
| 	} | 	} | ||||||
| 	return false, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Int returns the integer value for a given key. | // Int returns the integer value for a given key. | ||||||
| @ -68,7 +67,6 @@ func (c *JsonConfigContainer) Int(key string) (int, error) { | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0, errors.New("not exist key:" + key) | 		return 0, errors.New("not exist key:" + key) | ||||||
| 	} | 	} | ||||||
| 	return 0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Int64 returns the int64 value for a given key. | // Int64 returns the int64 value for a given key. | ||||||
| @ -83,7 +81,6 @@ func (c *JsonConfigContainer) Int64(key string) (int64, error) { | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0, errors.New("not exist key:" + key) | 		return 0, errors.New("not exist key:" + key) | ||||||
| 	} | 	} | ||||||
| 	return 0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Float returns the float value for a given key. | // Float returns the float value for a given key. | ||||||
| @ -98,7 +95,6 @@ func (c *JsonConfigContainer) Float(key string) (float64, error) { | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0.0, errors.New("not exist key:" + key) | 		return 0.0, errors.New("not exist key:" + key) | ||||||
| 	} | 	} | ||||||
| 	return 0.0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // String returns the string value for a given key. | // String returns the string value for a given key. | ||||||
| @ -113,7 +109,6 @@ func (c *JsonConfigContainer) String(key string) string { | |||||||
| 	} else { | 	} else { | ||||||
| 		return "" | 		return "" | ||||||
| 	} | 	} | ||||||
| 	return "" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Strings returns the []string value for a given key. | // Strings returns the []string value for a given key. | ||||||
| @ -137,7 +132,6 @@ func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil, errors.New("not exist key") | 		return nil, errors.New("not exist key") | ||||||
| 	} | 	} | ||||||
| 	return nil, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // section.key or key | // section.key or key | ||||||
|  | |||||||
| @ -153,7 +153,6 @@ func (c *Controller) RenderBytes() ([]byte, error) { | |||||||
| 		newbytes := bytes.NewBufferString("") | 		newbytes := bytes.NewBufferString("") | ||||||
| 		if _, ok := BeeTemplates[c.TplNames]; !ok { | 		if _, ok := BeeTemplates[c.TplNames]; !ok { | ||||||
| 			panic("can't find templatefile in the path:" + c.TplNames) | 			panic("can't find templatefile in the path:" + c.TplNames) | ||||||
| 			return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames) |  | ||||||
| 		} | 		} | ||||||
| 		err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data) | 		err := BeeTemplates[c.TplNames].ExecuteTemplate(newbytes, c.TplNames, c.Data) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @ -199,7 +198,6 @@ func (c *Controller) RenderBytes() ([]byte, error) { | |||||||
| 		ibytes := bytes.NewBufferString("") | 		ibytes := bytes.NewBufferString("") | ||||||
| 		if _, ok := BeeTemplates[c.TplNames]; !ok { | 		if _, ok := BeeTemplates[c.TplNames]; !ok { | ||||||
| 			panic("can't find templatefile in the path:" + c.TplNames) | 			panic("can't find templatefile in the path:" + c.TplNames) | ||||||
| 			return []byte{}, errors.New("can't find templatefile in the path:" + c.TplNames) |  | ||||||
| 		} | 		} | ||||||
| 		err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data) | 		err := BeeTemplates[c.TplNames].ExecuteTemplate(ibytes, c.TplNames, c.Data) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @ -209,7 +207,6 @@ func (c *Controller) RenderBytes() ([]byte, error) { | |||||||
| 		icontent, _ := ioutil.ReadAll(ibytes) | 		icontent, _ := ioutil.ReadAll(ibytes) | ||||||
| 		return icontent, nil | 		return icontent, nil | ||||||
| 	} | 	} | ||||||
| 	return []byte{}, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Redirect sends the redirection response to url with status code. | // Redirect sends the redirection response to url with status code. | ||||||
| @ -243,7 +240,6 @@ func (c *Controller) UrlFor(endpoint string, values ...string) string { | |||||||
| 	} else { | 	} else { | ||||||
| 		return UrlFor(endpoint, values...) | 		return UrlFor(endpoint, values...) | ||||||
| 	} | 	} | ||||||
| 	return "" |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // ServeJson sends a json response with encoding charset. | // ServeJson sends a json response with encoding charset. | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ type FileLogWriter struct { | |||||||
| 
 | 
 | ||||||
| 	// Rotate daily | 	// Rotate daily | ||||||
| 	Daily          bool  `json:"daily"` | 	Daily          bool  `json:"daily"` | ||||||
| 	Maxdays        int64 `json:"maxdays` | 	Maxdays        int64 `json:"maxdays"` | ||||||
| 	daily_opendate int | 	daily_opendate int | ||||||
| 
 | 
 | ||||||
| 	Rotate bool `json:"rotate"` | 	Rotate bool `json:"rotate"` | ||||||
|  | |||||||
| @ -195,5 +195,4 @@ func getAcceptEncodingZip(r *http.Request) string { | |||||||
| 	} else { | 	} else { | ||||||
| 		return "" | 		return "" | ||||||
| 	} | 	} | ||||||
| 	return "" |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -446,7 +446,6 @@ func (d *dbBase) Update(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time. | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0, err | 		return 0, err | ||||||
| 	} | 	} | ||||||
| 	return 0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // execute delete sql dbQuerier with given struct reflect.Value. | // execute delete sql dbQuerier with given struct reflect.Value. | ||||||
| @ -489,7 +488,6 @@ func (d *dbBase) Delete(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time. | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0, err | 		return 0, err | ||||||
| 	} | 	} | ||||||
| 	return 0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // update table-related record by querySet. | // update table-related record by querySet. | ||||||
| @ -566,7 +564,6 @@ func (d *dbBase) UpdateBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0, err | 		return 0, err | ||||||
| 	} | 	} | ||||||
| 	return 0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // delete related records. | // delete related records. | ||||||
| @ -671,8 +668,6 @@ func (d *dbBase) DeleteBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Con | |||||||
| 	} else { | 	} else { | ||||||
| 		return 0, err | 		return 0, err | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	return 0, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // read related records. | // read related records. | ||||||
|  | |||||||
| @ -13,7 +13,6 @@ func getDbAlias(name string) *alias { | |||||||
| 	} else { | 	} else { | ||||||
| 		panic(fmt.Errorf("unknown DataBase alias name %s", name)) | 		panic(fmt.Errorf("unknown DataBase alias name %s", name)) | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // get pk column info. | // get pk column info. | ||||||
|  | |||||||
| @ -83,7 +83,6 @@ func (e *JsonField) SetRaw(value interface{}) error { | |||||||
| 	default: | 	default: | ||||||
| 		return fmt.Errorf("<JsonField.SetRaw> unknown value `%v`", value) | 		return fmt.Errorf("<JsonField.SetRaw> unknown value `%v`", value) | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (e *JsonField) RawValue() interface{} { | func (e *JsonField) RawValue() interface{} { | ||||||
| @ -122,7 +121,7 @@ type DataNull struct { | |||||||
| 	Char        string          `orm:"null;size(50)"` | 	Char        string          `orm:"null;size(50)"` | ||||||
| 	Text        string          `orm:"null;type(text)"` | 	Text        string          `orm:"null;type(text)"` | ||||||
| 	Date        time.Time       `orm:"null;type(date)"` | 	Date        time.Time       `orm:"null;type(date)"` | ||||||
| 	DateTime    time.Time       `orm:"null;column(datetime)""` | 	DateTime    time.Time       `orm:"null;column(datetime)"` | ||||||
| 	Byte        byte            `orm:"null"` | 	Byte        byte            `orm:"null"` | ||||||
| 	Rune        rune            `orm:"null"` | 	Rune        rune            `orm:"null"` | ||||||
| 	Int         int             `orm:"null"` | 	Int         int             `orm:"null"` | ||||||
|  | |||||||
| @ -293,7 +293,7 @@ func (o *orm) queryRelated(md interface{}, name string) (*modelInfo, *fieldInfo, | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if qs == nil { | 	if qs == nil { | ||||||
| 		panic(fmt.Errorf("<Ormer> name `%s` for model `%s` is not an available rel/reverse field")) | 		panic(fmt.Errorf("<Ormer> name `%s` for model `%s` is not an available rel/reverse field", md, name)) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return mi, fi, ind, qs | 	return mi, fi, ind, qs | ||||||
| @ -441,8 +441,6 @@ func (o *orm) Driver() Driver { | |||||||
| 
 | 
 | ||||||
| func (o *orm) GetDB() dbQuerier { | func (o *orm) GetDB() dbQuerier { | ||||||
| 	panic(ErrNotImplement) | 	panic(ErrNotImplement) | ||||||
| 	// not enough |  | ||||||
| 	return o.db |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // create new orm | // create new orm | ||||||
|  | |||||||
| @ -209,7 +209,6 @@ func (o *querySet) ValuesFlat(result *ParamsList, expr string) (int64, error) { | |||||||
| // } | // } | ||||||
| func (o *querySet) RowsToMap(result *Params, keyCol, valueCol string) (int64, error) { | func (o *querySet) RowsToMap(result *Params, keyCol, valueCol string) (int64, error) { | ||||||
| 	panic(ErrNotImplement) | 	panic(ErrNotImplement) | ||||||
| 	return o.orm.alias.DbBaser.RowsTo(o.orm.db, o, o.mi, o.cond, result, keyCol, valueCol, o.orm.alias.TZ) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // query all rows into struct with specify key and value column name. | // query all rows into struct with specify key and value column name. | ||||||
| @ -224,7 +223,6 @@ func (o *querySet) RowsToMap(result *Params, keyCol, valueCol string) (int64, er | |||||||
| // } | // } | ||||||
| func (o *querySet) RowsToStruct(ptrStruct interface{}, keyCol, valueCol string) (int64, error) { | func (o *querySet) RowsToStruct(ptrStruct interface{}, keyCol, valueCol string) (int64, error) { | ||||||
| 	panic(ErrNotImplement) | 	panic(ErrNotImplement) | ||||||
| 	return o.orm.alias.DbBaser.RowsTo(o.orm.db, o, o.mi, o.cond, ptrStruct, keyCol, valueCol, o.orm.alias.TZ) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // create new QuerySeter. | // create new QuerySeter. | ||||||
|  | |||||||
| @ -282,10 +282,10 @@ func TestNullDataTypes(t *testing.T) { | |||||||
| 
 | 
 | ||||||
| 	d = DataNull{ | 	d = DataNull{ | ||||||
| 		DateTime:    time.Now(), | 		DateTime:    time.Now(), | ||||||
| 		NullString:  sql.NullString{"test", true}, | 		NullString:  sql.NullString{String: "test", Valid: true}, | ||||||
| 		NullBool:    sql.NullBool{true, true}, | 		NullBool:    sql.NullBool{Bool: true, Valid: true}, | ||||||
| 		NullInt64:   sql.NullInt64{42, true}, | 		NullInt64:   sql.NullInt64{Int64: 42, Valid: true}, | ||||||
| 		NullFloat64: sql.NullFloat64{42.42, true}, | 		NullFloat64: sql.NullFloat64{Float64: 42.42, Valid: true}, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	id, err = dORM.Insert(&d) | 	id, err = dORM.Insert(&d) | ||||||
|  | |||||||
| @ -266,5 +266,4 @@ func indirectType(v reflect.Type) reflect.Type { | |||||||
| 	default: | 	default: | ||||||
| 		return v | 		return v | ||||||
| 	} | 	} | ||||||
| 	return v |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ type conn struct { | |||||||
| 	net.Conn | 	net.Conn | ||||||
| 	wg      *sync.WaitGroup | 	wg      *sync.WaitGroup | ||||||
| 	isclose bool | 	isclose bool | ||||||
| 	lock    sync.Mutex | 	lock    *sync.Mutex | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Close current processing connection. | // Close current processing connection. | ||||||
| @ -102,7 +102,6 @@ func WaitSignal(l net.Listener) error { | |||||||
| 			return nil | 			return nil | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return nil // It'll never get here. |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Kill current running os process. | // Kill current running os process. | ||||||
|  | |||||||
| @ -216,7 +216,6 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface, mappingM | |||||||
| 		if regexErr != nil { | 		if regexErr != nil { | ||||||
| 			//TODO add error handling here to avoid panic | 			//TODO add error handling here to avoid panic | ||||||
| 			panic(regexErr) | 			panic(regexErr) | ||||||
| 			return |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		//now create the Route | 		//now create the Route | ||||||
|  | |||||||
| @ -43,7 +43,6 @@ func (cs *CouchbaseSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (cs *CouchbaseSessionStore) Delete(key interface{}) error { | func (cs *CouchbaseSessionStore) Delete(key interface{}) error { | ||||||
|  | |||||||
| @ -47,7 +47,6 @@ func (st *MysqlSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // delete value in mysql session | // delete value in mysql session | ||||||
|  | |||||||
| @ -68,7 +68,6 @@ func (st *PostgresqlSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // delete value in postgresql session | // delete value in postgresql session | ||||||
|  | |||||||
| @ -44,7 +44,6 @@ func (rs *RedisSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // delete value in redis session | // delete value in redis session | ||||||
|  | |||||||
| @ -36,7 +36,6 @@ func (st *CookieSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Delete value in cookie session | // Delete value in cookie session | ||||||
|  | |||||||
| @ -43,7 +43,6 @@ func (fs *FileSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Delete value in file session by given key | // Delete value in file session by given key | ||||||
|  | |||||||
| @ -35,7 +35,6 @@ func (st *MemSessionStore) Get(key interface{}) interface{} { | |||||||
| 	} else { | 	} else { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // delete in memory session by key | // delete in memory session by key | ||||||
| @ -94,7 +93,6 @@ func (pder *MemProvider) SessionRead(sid string) (SessionStore, error) { | |||||||
| 		pder.lock.Unlock() | 		pder.lock.Unlock() | ||||||
| 		return newsess, nil | 		return newsess, nil | ||||||
| 	} | 	} | ||||||
| 	return nil, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // check session store exist in memory session by sid | // check session store exist in memory session by sid | ||||||
| @ -129,7 +127,6 @@ func (pder *MemProvider) SessionRegenerate(oldsid, sid string) (SessionStore, er | |||||||
| 		pder.lock.Unlock() | 		pder.lock.Unlock() | ||||||
| 		return newsess, nil | 		return newsess, nil | ||||||
| 	} | 	} | ||||||
| 	return nil, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // delete session store in memory session by id | // delete session store in memory session by id | ||||||
|  | |||||||
| @ -164,8 +164,6 @@ func decodeCookie(block cipher.Block, hashKey, name, value string, gcmaxlifetime | |||||||
| 	} else { | 	} else { | ||||||
| 		return dst, nil | 		return dst, nil | ||||||
| 	} | 	} | ||||||
| 	// Done. |  | ||||||
| 	return nil, nil |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Encoding ------------------------------------------------------------------- | // Encoding ------------------------------------------------------------------- | ||||||
|  | |||||||
| @ -48,7 +48,7 @@ func ProcessInput(input string, w io.Writer) { | |||||||
| // record memory profile in pprof | // record memory profile in pprof | ||||||
| func MemProf() { | func MemProf() { | ||||||
| 	if f, err := os.Create("mem-" + strconv.Itoa(pid) + ".memprof"); err != nil { | 	if f, err := os.Create("mem-" + strconv.Itoa(pid) + ".memprof"); err != nil { | ||||||
| 		log.Fatal("record memory profile failed: %v", err) | 		log.Fatal("record memory profile failed: ", err) | ||||||
| 	} else { | 	} else { | ||||||
| 		runtime.GC() | 		runtime.GC() | ||||||
| 		pprof.WriteHeapProfile(f) | 		pprof.WriteHeapProfile(f) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user